Java Logger vs Log4J

T

Tony Lockyer

Hi All:

I'm trying to customize the pattern of logging output with Java Logger
similar to what you can do with log4J. Anyone know if this is possible?
 
R

Rene

Tony Lockyer said:
I'm trying to customize the pattern of logging output with Java Logger
similar to what you can do with log4J. Anyone know if this is possible?

Yes it is, however you need to write your own Formatter. See the abstract
class java.util.logging.Formatter[1] - you get
java.util.logging.LogRecord's[2] as input which should have all needed
fields to create a similar output as log4j's PatternLayout is able to.

[1]
http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Formatter.html
[2]
http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/LogRecord.html

CU

René
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top