question

Upvotes
Accepted
2 0 2 5

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 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
32.2k 41 11 20

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 512.0 KiB each and 1.0 MiB total.

Thankyou zoya faberov for the response.

Do you have similar example for xml base log4 configuration?

Upvotes
32.2k 41 11 20

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 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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