how to capture thse SEVERE com.thomsonreuters.ema.access.ChannelCallbackClient
error types in log4j logging file in java?
Hello @bmahajan ,
To capture these in Log4J you would pass a command line VM argument, for example:
-Djava.util.logging.config.file=.\logging.properties
With your custom logging.properties file defining how you wish to log into a file.
I use the following logging.properties file that I put in the same directory and that was at some point adapted from an online sample. It logs timestamped, into emaj.log.X files:
#This file contains log configuration for java logging API .level=INFO handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler #handlers=java.util.logging.ConsoleHandler java.util.logging.ConsoleHandler.level=WARNING java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter java.util.logging.FileHandler.level=FINEST java.util.logging.FileHandler.pattern=.\emaj.log # Write 100000 bytes before rotating this file java.util.logging.FileHandler.limit=50000000 # Number of rotating files to be used java.util.logging.FileHandler.count=20 java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter # Format timestamp as date/time with millisecond java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL %4$-7s %2$s %n%5$s
For mode details on Log4J properties spec, and examples, there are many relevant online resource, such as:
Thankyou zoya faberov for the response.
Do you have similar example for xml base log4 configuration?
Hello @bmahajan
Log4j XMLLayout – Create Logs in XML File should help with XML logging.