Reputation: 1008
I am using a .jar file and read from a logging.properties
file.
This is the command I use to start the application ( a proxy application )
java -Djava.util.logging.config.file=logging.properties -jar CMDHL7Proxy_v0.7.jar
I already configured the file logging.properties
to log to a file.
This is the content of my logging.properties
file:
handlers= java.util.logging.FileHandler
java.util.logging.FileHandler.pattern = /opt/log/Proxy_%u_%g.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
# Facility specific properties. Provides extra control for each logger.
# For example, set the com.xyz.foo logger to only log SEVERE messages:
com.xyz.foo.level = SEVERE
ca.uhn.log.HapiLogImpl = OFF
au.id.czapski.hl7.SimpleForwardApplicaiton = ALL
If I look into the .log
file then I see log messages from:
Jan 28, 2019 5:48:31 PM ca.uhn.log.HapiLogImpl info
<.... logged content .... >
<.... logged content .... >
and
Jan 28, 2019 5:29:34 PM au.id.czapski.hl7.SimpleForwardApplicaiton processMessage
<.... logged content .... >
<.... logged content .... >
My Goal is to only get messages from this logger "au.id.czapski.hl7.SimpleForwardApplicaiton"
My understanding tells me the the last two lines in my logging.properties
file should tell java to not log anything from the first logger but everything from the second logger.
I also tried setting different values with .level
and java.util.logging.FileHandler.level
but to set java.util.logging.FileHandler.level=processMessage
did result in a configuration error.
Can someone help me to achieve my desired behavior by only modifying the logging.properties
file.
Upvotes: 1
Views: 5214
Reputation: 11045
Looks like:
Try setting the root logger to OFF and only turning on logger you want to see
handlers= java.util.logging.FileHandler
java.util.logging.FileHandler.pattern = /opt/log/Proxy_%u_%g.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.level = ALL
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
.level=OFF
au.id.czapski.hl7.SimpleForwardApplicaiton.level = ALL
au.id.czapski.hl7.SimpleForwardApplication.level = ALL
Upvotes: 2