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

Log4j2 - Ignores %line and incorrect logger name #144

Open
MosheElisha opened this issue Mar 24, 2020 · 6 comments
Open

Log4j2 - Ignores %line and incorrect logger name #144

MosheElisha opened this issue Mar 24, 2020 · 6 comments
Labels
P3 type=defect Bug, not working as expected

Comments

@MosheElisha
Copy link

Hi,

Thank you for adding log4j2 support.

When trying to use v 0.5 with the attached line-number-test.zip I see the following output:

2020-03-25T00:26:20,476 [main] INFO  example.LogTest:INFO in 18b4aac2: - Info
2020-03-25T00:26:20,484 [main] WARN  example.LogTest:INFO in 18b4aac2: - Warn
2020-03-25T00:26:20,484 [main] ERROR example.LogTest:INFO in 18b4aac2: - Severe
  1. The Logger name is incorrect (should be example.LogTest instead of example.LogTest:INFO in 18b4aac2
  2. The line number is missing from the message although pattern contains %line . I noticed there is an internal Option.WITH_LOG_SITE but couldn't find a way to influence that and I would expect that having %line would be sufficient.
@hagbard
Copy link
Contributor

hagbard commented Mar 25, 2020

You've already raised this.

@hagbard hagbard closed this as completed Mar 25, 2020
@MosheElisha
Copy link
Author

Hi,

I was under the impression that it is different because here I am using the log4j2 backend directly (flogger-log4j2-backend). The attached project is also different from the project attached in issue #140

@hagbard
Copy link
Contributor

hagbard commented Mar 25, 2020

True, but fixing one will inevitably fix the other. SLF4J + log4J2 backend is going to be almost exactly the same same code, just with a very thin layer in SLF4J. To be honest I'd rather we didn't even have and SLF4J "backend" (since SLF4J is not a logging backend API).

@hagbard hagbard reopened this Mar 25, 2020
@MosheElisha
Copy link
Author

MosheElisha commented Mar 25, 2020

True, but fixing one will inevitably fix the other

OK. Thanks for the clarification.

To be honest I'd rather we didn't even have and SLF4J "backend"

Yes, I see your point. A direct backend is obviously preferable but on the other hand, "SLF4J backend" acts as a bridge to many popular backends as most of the logging frameworks already have an slf4j adapter. It can be very helpful. At lease until a proper specific backend will be implemented.

@hagbard
Copy link
Contributor

hagbard commented Mar 25, 2020

The issue is that if there SLF4J API was not written to expect to be called from another logging API we might never be able to address things like the line number issue when using it.

My gut feeling is that JDK and Log4J2 between them will be the vast majority of cases. I'm much less inclined to spend time on Log4J (v1) and SLF4J when it comes to features and bugs (diminishing returns) but I'd always be grateful for fixes if other people want to make them.

@nick-someone nick-someone added P3 type=defect Bug, not working as expected labels Mar 30, 2020
@charu-jain89
Copy link

Hi @MosheElisha , Did you get any solution or workaround of this issue? I have raised similar issue here: #360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 type=defect Bug, not working as expected
Projects
None yet
Development

No branches or pull requests

4 participants