logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 46483] New: Truncating the end of the log message using a PatternLayout
Date Tue, 06 Jan 2009 21:15:06 GMT

           Summary: Truncating the end of the log message using a
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Layout
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: mrnohr@yahoo.com

I have an appender that I only want to display the first X characters (for this
example, we'll say 5) of the message.

I am using PatternLayout, and I can only get the message to truncate from the
end, which displays the last X characters.

For example, if my log message is "The quick brown fox" I want to see "The q"
(first 5 characters).  If I use the pattern, "%.5m" I get "n fox" (last 5

I would expect that the pattern, "%-.5m" would accomplish this.  However, this
also returns "n fox" (last 5 characters).  When dealing with padding, the "-"
character changes the padding from left to right.

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

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

View raw message