This repository has been archived by the owner on Jan 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Add log4j logging and bridge #387
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -30,6 +30,9 @@ dependencies { | |||||||
implementation "org.metafacture:metafacture-xml:${versions.metafacture}" | ||||||||
implementation "org.metafacture:metafacture-yaml:${versions.metafacture}" | ||||||||
implementation "org.metafacture:metamorph:${versions.metafacture}" | ||||||||
runtimeOnly 'org.apache.logging.log4j:log4j-core' | ||||||||
implementation 'org.apache.logging.log4j:log4j-1.2-api:2.9.1' | ||||||||
implementation 'ch.qos.logback:logback-classic:1.3.14' | ||||||||
Comment on lines
+33
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No additional dependencies required:
Suggested change
|
||||||||
|
||||||||
implementation('org.antlr:antlr-runtime') { | ||||||||
version { strictly versions.antlr } | ||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE log4j:configuration SYSTEM "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd"> | ||
|
||
<log4j:configuration> | ||
<appender name="stdout" class="org.apache.log4j.ConsoleAppender"> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param name="ConversionPattern" | ||
value="%-5p [%t] [%c{1}] %m%n" /> | ||
</layout> | ||
</appender> | ||
|
||
<root> | ||
<priority value="${org.metafacture.metafix.logLevel}" /> | ||
<appender-ref ref="stdout" /> | ||
</root> | ||
|
||
</log4j:configuration> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this suggestion, I get no logging output, and the same
Class path contains multiple SLF4J bindings.
warning that I get without this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That warning aside (different issue, IMO), you would have to increase the log level to
DEBUG
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with
DEBUG
inlog4j.xml
: no logging output. As you wrote below, it must be using some other config?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not what I saw. Changing the log level (priority) in
log4j.xml
and then running./gradlew installDist
yields debug output withlog-object
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird, I have
<priority value="DEBUG" />
inmetafix/src/main/resources/log4j.xml
, onlyruntimeOnly "org.slf4j:slf4j-log4j12:${versions.slf4j}"
added inmetafix-runner/build.gradle
: no logging output forlog-object
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And you ran
./gradlew installDist
afterwards? For me onmaster
:log4j.xml
from metafacture-core tometafix/src/main/resources/
.info
toDEBUG
inmetafix/src/main/resources/log4j.xml
.runtimeOnly "org.slf4j:slf4j-log4j12:${versions.slf4j}"
tometafix-runner/build.gradle
../gradlew installDist
.metafix-runner/build/install/metafix-runner
directory.bin/metafix-runner /path/to/flux-with-log-object
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blackwinter your proposal is working for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried it on my home machine, and here it works. Maybe some cached dependency bringing in some other config file on my office machine? So that would be +1 for using only
runtimeOnly "org.slf4j:slf4j-log4j12:${versions.slf4j}"
. However, it works here even without adding any dependency, just by switchingINFO
toDEBUG
inmetafix/src/main/resources/log4j.xml
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. Probably because it's pulled in by metafacture-runner. So let's just drop it altogether then.