Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize logging libraries for Java components #277

Closed
woop opened this issue Oct 29, 2019 · 10 comments · Fixed by #430
Closed

Standardize logging libraries for Java components #277

woop opened this issue Oct 29, 2019 · 10 comments · Fixed by #430
Labels
good first issue Good for newcomers kind/housekeeping wontfix This will not be worked on

Comments

@woop
Copy link
Member

woop commented Oct 29, 2019

Currently there is a mix of logging libraries being used in the Java components (ingestion, serving, core). We currently used both SLF4J and Log4j2.

The plan is to standardize on only SLF4J, and this issue tracks the work item.

@woop woop changed the title Standardize logging libraries for Java Standardize logging libraries for Java components Oct 29, 2019
@ches
Copy link
Member

ches commented Oct 30, 2019

Bringing some rationale into context here, @davidheryanto pointed out that SLF4J is recommended for Beam.

Practically speaking I believe this means library modules in Feast should use the SLF4J API (only slf4j-api dependency), and the executable applications use Logback as the de facto implementation.

@ches
Copy link
Member

ches commented Jan 27, 2020

Reopening as I think #430 hasn't completely addressed this:

  1. That PR added log4j-slf4j-impl which "allows applications coded to the SLF4J API to use Log4j 2 as the implementation". I think (?) what we decided is that we want the opposite, SLF4J as the implementation (and API), if we are already committed to it as the "lowest common denominator" by Beam. Good summary info about all this on SO.
  2. We still have direct usage of both APIs in Feast. The last holdout of Log4j2 is core/src/main/java/feast/core/log/AuditLogger.java. SLF4J is used a lot "by hand" and with the Lombok annotation.

I guess my acceptance criterion for closing this issue would be:

A Feast operator does not need to configure both a logback.xml and log4j2.xml to change logging behavior for their deployment. (A Feast developer shouldn't either).

If there are Feast dependencies which use the Log4j (2) APIs, we should take care of the bridging so that they don't need to think about all this.

@Yanson
Copy link
Contributor

Yanson commented Jan 30, 2020

Agree that #430 doesn't fully fix this issue. All that did was remove any impl from ingestion and standardise on log4j impl for core and serving to give them both JSON logging and env conf.

The link you posted suggests using log4j2 API, not "SLF4J as the implementation (and API)".

Given Dataflow will work with log4j or slf4j, I don't think it matters which we standardise on. However, since log4j2 offers more functionality (which we are using in AuditLogger), I think that is the more sensible choice.

Alternatively we could stick to slf4j just for ingestion and use log4j for core + serving.

Also note that the feast java sdk has an import of slf4j, though the instance is not used. I think I would prefer slf4j as a more standard api dependency for a library but it could be removed altogether.

Happy to make the changes if we decide on a forward path.

@stale
Copy link

stale bot commented Mar 30, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Mar 30, 2020
@woop woop added the keep-open label Apr 4, 2020
@stale stale bot removed the wontfix This will not be worked on label Apr 4, 2020
@ches
Copy link
Member

ches commented Jul 2, 2020

The link you posted suggests using log4j2 API, not "SLF4J as the implementation (and API)".

(For the record, my intention for the SO link I shared was for its objective summary info, not its (biased) recommendation).

I don't have a particularly strong opinion on which to use, and frankly I wish I could have some of my life back that has gone to the age-old pissing contest of Java logging frameworks and finding libraries that include concrete impls that require exclusions… I would just like a clear guideline stating what to use, per module if mixing is really justified.

AuditLogger seems to have gotten the axe now, so I believe there is no usage of Log4j2 API and thus any of its exclusive features (except optional JSON format in config). But, Core and Serving have long shipped log4j2.xml, so changing implementation would be annoying for operators at upgrade to change format of custom/overriding configurations.

I guess we should stay with things as they are, and document it. I'd agree that slf4j-api still seems much more established for a library like the SDK at this point in time.

@stale
Copy link

stale bot commented Apr 9, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Apr 9, 2021
@danielsiwiec
Copy link
Contributor

Does this issue still require any work? I'd be happy to help wrap this one up

@stale stale bot removed the wontfix This will not be worked on label Apr 15, 2021
@danielsiwiec
Copy link
Contributor

@woop I'm happy to lean in here, if this still needs any work

@woop
Copy link
Member Author

woop commented Jul 5, 2021

Hey @danielsiwiec. Happy for contributions here if you want to take a stab at it. This issue has gone under the radar for quite some time.

@stale
Copy link

stale bot commented Nov 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Nov 2, 2021
@stale stale bot closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/housekeeping wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants