logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From go...@tarsec.com
Subject [PATCH] Additional PatternLayout conversion characters
Date Wed, 20 Feb 2002 12:53:00 GMT
Hi

I propose two new pattern letters, %P and %T. The reasons for it are:
- shorter log lines for improved readability
- create more space for log line text (at the end of the line)

The attached tar file contains "cvs diff -u ..." from all involved files.

I hope I got everything right. If not, I would be happy if you help me improve
future contributions.

Regards
-Bernd.


Details
=======

The following files are involved in the changes:
...
M src/java/org/apache/log4j/Level.java
M src/java/org/apache/log4j/PatternLayout.java
M src/java/org/apache/log4j/Priority.java
cvs server: Updating src/java/org/apache/log4j/config
cvs server: Updating src/java/org/apache/log4j/helpers
M src/java/org/apache/log4j/helpers/PatternParser.java
cvs server: Updating src/java/org/apache/log4j/jmx
cvs server: Updating src/java/org/apache/log4j/net
cvs server: Updating src/java/org/apache/log4j/net/test
cvs server: Updating src/java/org/apache/log4j/nt
cvs server: Updating src/java/org/apache/log4j/nt/test
cvs server: Updating src/java/org/apache/log4j/or
cvs server: Updating src/java/org/apache/log4j/or/jms
cvs server: Updating src/java/org/apache/log4j/or/sax
cvs server: Updating src/java/org/apache/log4j/performance
cvs server: Updating src/java/org/apache/log4j/performance/history
cvs server: Updating src/java/org/apache/log4j/performance/xml
cvs server: Updating src/java/org/apache/log4j/spi
M src/java/org/apache/log4j/spi/LoggingEvent.java
...
------


Sample output
-------------
a) long format with %p %t
ConversionPattern="%d %p %t %-6c (%13F:%L) [%x] - %m%n"

2002-02-19 23:02:34,718 FATAL main basic  (BasicTest.java:42) [] - Fatal message
2002-02-19 23:02:34,728 ERROR main basic  (BasicTest.java:43) [] - Error message
2002-02-19 23:02:34,728 WARN main basic  (BasicTest.java:44) [] - Warn message
2002-02-19 23:02:34,728 INFO main basic  (BasicTest.java:45) [] - Info message
2002-02-19 23:02:34,728 DEBUG main basic  (BasicTest.java:46) [] - Debug message

------------------------

b) short format with %P %T
ConversionPattern="%d %P %3T %-6c (%13F:%L) [%x] - %m%n"

2002-02-19 23:01:36,595 F   m basic  (BasicTest.java:42) [] - Fatal message
2002-02-19 23:01:36,605 E   m basic  (BasicTest.java:43) [] - Error message
2002-02-19 23:01:36,605 W   m basic  (BasicTest.java:44) [] - Warn message
2002-02-19 23:01:36,605 I   m basic  (BasicTest.java:45) [] - Info message
2002-02-19 23:01:36,615 D   m basic  (BasicTest.java:46) [] - Debug message


-- 
Bernd Goetz                                     goetz@tarsec.com
TARSEC AG                                       Tel +41 1 496 61 11
Rautistrasse 12                                 Fax +41 1 496 61 99
Postfach                                        Mobile +41 79 759 04 26
8047 Zurich, Switzerland                        http://www.tarsec.com
Mime
View raw message