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=INFOhandlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler#handlers=java.util.logging.ConsoleHandlerjava.util.logging.ConsoleHandler.level=WARNINGjava.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatterjava.util.logging.FileHandler.level=FINESTjava.util.logging.FileHandler.pattern=.\emaj.log# Write 100000 bytes before rotating this filejava.util.logging.FileHandler.limit=50000000# Number of rotating files to be usedjava.util.logging.FileHandler.count=20java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter# Format timestamp as date/time with millisecondjava.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:
Log4J Example
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.