severb / graypy

Python logging handler for Graylog that sends messages in GELF (Graylog Extended Log Format).
https://www.graylog.org/
BSD 3-Clause "New" or "Revised" License
258 stars 90 forks source link

Why GELFHandler is deprecated? #105

Closed Urahara closed 5 years ago

Urahara commented 5 years ago

I just run pip install graypy today on new machine that i using and them a get this error on older project.

AttributeError: module 'graypy' has no attribute 'GELFHandler'
nklapste commented 5 years ago

Sorry for breaking compatibility, GELFHandler has been replaced with GELFUDPHandler to be more explicit on its implementation (and possibly highlighting the potential issues with sending logs via UDP).

Note: Similar changes were done with GELFTcpHandler being restructured into GELFTCPHandler and GELFTLSHandler to improve explicitness.

Any version of graypy 0.X.X should support the old definition of GELFHandler and GELFTcpHandler. Any version of 1.X.X does not support GELFHandler and GELFTcpHandler.

nklapste commented 5 years ago

@Urahara see #106 for a possible solution to improve backwards compatibility from 0.3.X to 1.X.X.

Though I'm not 100% sold on adding back class aliases that are immediately deprecated and are likely to be removed anyways within the future. If demand is high enough I can implement these changes, but, otherwise it might be easier to either update your older projects, or simply lock requirements of graypy to 0.3.X.

Urahara commented 5 years ago

@nklapste Thanks for clarify! What surprised me was that there were several releases in the last few days and i didn't know where these changes occurred. I think it would be nice to have this backward compatibility like you implemented on #106 using warning to notify users that GELFHandler was deprecated.

nklapste commented 5 years ago

@Urahara The removal of GELFHandler was first done within 1.0.0

Adding backwards compatibility for GELFHandler is relatively easy and I'm okay with adding such functionality.

However, a similar case for GELFTcpHandler is currently having issues with making a straightforward port (mainly due to its method of creating a TLS socket in some cases). Likely GELFTcpHandler is going to be completely unsupported in 1.X.X.

Urahara commented 5 years ago

I understand, but i think that who is having issues with GELFTcpHandler probably will update to use new definition.

nklapste commented 5 years ago

Looking at the changes needed to accommodate backporting (see #108 and #106) and how they directly invalidate the API breaking notation of bumping graypy's version to 1.X.X. I think its better to not resolve the breaking changes introduced 1.X.X.

Additionally, since in graypy 0.3.X BaseGELFHandler did not inherit from a python logging.Handler (1.X.X does) there is possibility that unintentional behavior could be experienced with inheriting classes such as GELFHandler. To avoid unexpected behavior from upgrading to 1.X.X GELFHandler (and GELFTcpHandler) were removed.

If you wish to still use the GELFHandler notation I would recommend locking your requirements or forcefully installing a older version of graypy after installing your old project (e.g. pip install -I graypy==0.3.2).