question

Upvotes
Accepted
2 0 0 3

SEVERE com.thomsonreuters.ema.access.ChannelCallbackClient

how to capture thse SEVERE com.thomsonreuters.ema.access.ChannelCallbackClient

error types in log4j logging file in java?

ema-apijava
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvote
Accepted
23k 22 9 14

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:

Log4J Example

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Thankyou zoya faberov for the response.

Do you have similar example for xml base log4 configuration?

Upvotes
23k 22 9 14

Hello @bmahajan

Log4j XMLLayout – Create Logs in XML File should help with XML logging.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea