apache / logging-log4j2

Apache Log4j 2 is a versatile, feature-rich, efficient logging API and backend for Java.
https://logging.apache.org/log4j/2.x/
Apache License 2.0
3.36k stars 1.6k forks source link

Wrapper layout compressing the output of a delegate (LOG4J2-3023) #2496

Open der-eismann opened 5 months ago

der-eismann commented 5 months ago

As it was explained in https://github.com/apache/logging-log4j2/discussions/2495#discussioncomment-9186368, all JSON-based layouts are deprecated in favor of JSON Template Layout. However the GELF layout has a compressionType option, which is missing from the JTL. Would be really nice to have, as it can save a nice amount of traffic costs.

vy commented 5 months ago

Instead adding compression support to <your-layout-of-preference>, we better create a wrapper layout that compresses the output of another layout. This issue has already been discussed in LOG4J2-3023.

@der-eismann, would you be interested in submitting a PR? If so, I would be more than happy to assist you.

der-eismann commented 5 months ago

I'm kinda interested, but my Java knowledge is very basic and I'm not sure if my help is really useful here :see_no_evil:

ppkarwasz commented 5 months ago

I think we should introduce an OutputStream abstraction:

public interface OutputStreamWrapper {

    OutputStream wrap(OutputStream stream);
}

Such an abstraction could solve several issues:

ppkarwasz commented 5 months ago

I marked LOG4J2-3023 as duplicate of this issue, so we don't need to use JIRA any more.