Bug 1067 - Exception when using a badly formed layout
Summary: Exception when using a badly formed layout
Status: CLOSED FIXED
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Layout (show other bugs)
Version: unspecified
Hardware: PC other
: P1 normal
Target Milestone: ---
Assignee: log4j-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-03-21 09:41 UTC by Hauke Walden
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hauke Walden 2001-03-21 09:41:59 UTC
Hi,

I´m getting an Exception that crashes the logged application
when using this configuration file :

log4j.rootCategory=debug, stdout
log4j.appender.stdout=org.apache.log4j.FileAppender
log4j.appender.stdout.File=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{dat} [%t] %-5p %c - %m%n
                                                  ^^^
(Note the wrong constant "dat" after %d) 

The exception is:

java.lang.IllegalArgumentException: Illegal pattern character 't'
	at java.text.SimpleDateFormat.subFormat(SimpleDateFormat.java:477)
	at java.text.SimpleDateFormat.format(SimpleDateFormat.java:437)
	at java.text.DateFormat.format(DateFormat.java:305)
	at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert
(PatternParser.java:429)
	at org.apache.log4j.helpers.PatternConverter.format
(PatternConverter.java:56)
	at org.apache.log4j.PatternLayout.format(PatternLayout.java:472)
	at org.apache.log4j.FileAppender.subAppend(FileAppender.java:428)
	at org.apache.log4j.FileAppender.append(FileAppender.java:219)
	at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
	at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders
(AppenderAttachableImpl.java:56)
	at org.apache.log4j.Category.callAppenders(Category.java:258)
	at org.apache.log4j.Category.forcedLog(Category.java:454)
	at org.apache.log4j.Category.error(Category.java:367)
	at logtest.TestProg.main(TestProg.java:37)

Of course, I should not use "dat" instead of "date", but this could happen when 
using a "watch-for-changes-in-property-file" configuration while editing.

I hope this hadn´t been reported before ... this is the first time I´m using 
bugzilla ...

Thanks,
Hauke
Comment 1 Mathias Bogaert 2001-04-22 07:49:28 UTC
Fixed in log4j 1.1. Thanks for the report!