You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2007/08/16 10:38:10 UTC

DO NOT REPLY [Bug 43141] New: - LogFilePatternReceiver fails with "%-5p" etc

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43141>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43141

           Summary: LogFilePatternReceiver fails with "%-5p" etc
           Product: Log4j
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: chainsaw
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: lilianne_blaze@tlen.pl


Log file generated with:

  <appender name="xxx"
            class="org.apache.log4j.RollingFileAppender">
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %p [%t] %c (%F:%L) - %m%n"/>
    </layout>    

Looks like this:

2007-08-16 10:07:16,453 DEBUG [httpWorkerThread-4848-0] xxx (xxx.java:34) -
debug ***
2007-08-16 10:07:16,453 INFO [httpWorkerThread-4848-0] xxx (xxx.java:35) - info ***
2007-08-16 10:07:16,453 WARN [httpWorkerThread-4848-0] xxx (xxx.java:36) - warn ***
2007-08-16 10:07:16,453 ERROR [httpWorkerThread-4848-0] xxx (xxx.java:37) -
error ***

Chainsaw sees it correctly. It is configured with:

  <plugin name="LogFileReceiver"
class="org.apache.log4j.varia.LogFilePatternReceiver">
    <param name="fileURL" value="xxx"/>
    <param name="timestampFormat" value="yyyy-MM-dd HH:mm:ss,SSS"/> 
    <param name="logFormat"
           value="TIMESTAMP LEVEL [THREAD] LOGGER (FILE:LINE) - MESSAGE"/> 


When log4j is configured with:

<param name="ConversionPattern" value="%d %-5p [%t] %c (%F:%L) - %m%n"/>

Note "%-5p" instead of "%p", which is taken from:
http://logging.apache.org/log4j/docs/api/org/apache/log4j/PatternLayout.html

It outputs:

2007-08-16 10:10:19,875 DEBUG [pool-1-thread-7] xxx (xxx.java:34) - debug ***
2007-08-16 10:10:19,875 INFO  [pool-1-thread-7] xxx (xxx.java:35) - info ***
2007-08-16 10:10:19,875 WARN  [pool-1-thread-7] xxx (xxx.java:36) - warn ***
2007-08-16 10:10:19,875 ERROR [pool-1-thread-7] xxx (xxx.java:37) - error ***

Note "INFO space space [".

Chainsaw sees it as DEBUG "debug ***", DEBUG "info ***", DEBUG "warn ***", ERROR
"error ***"

Apparently double space " " messes up Level parsing, which defaults to DEBUG.

The easiest solution would be to add a String.trim() in private LoggingEvent
convertToEvent(Map fieldMap, String exception[] near "level =
(String)fieldMap.remove("LEVEL"); Level levelImpl = Level.toLevel(level);",
though I don't have the time to test it at this moment.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


DO NOT REPLY [Bug 43141] - LogFilePatternReceiver fails with "%-5p" etc

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43141>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43141


sdeboy@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE




------- Additional Comments From sdeboy@iname.com  2007-08-27 07:10 -------
This issue is a dup of 31727 - 

btw, this issue was fixed in svn revision 423737 (7/20/2006)



*** This bug has been marked as a duplicate of 31727 ***

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org