Log4j WriterAppender in Java

Hello,
Im using a WriterAppender to log to a file, but It will not display the time of each log... I've included the appropriate properties in the log4j.properties for that to work... When i switch over to a RollingFileAppender it works fine...

Also im getting a
log4j:ERROR No output stream or file set for the appender named [C:\temp\Log.log].
However the error log is still created in that file with the information that I need... The error msg is annoying so I would like to get rid of it... Attached is my code from the log4j.properties file
log4j.appender.myWriterAppender=org.apache.log4j.WriterAppender
log4j.appender.myWriterAppender.Name=C:\\temp\\Log.log
log4j.appender.myWriterAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.myWriterAppender.layout.ConversionPattern=[%d{ISO8601}] %5p: %m%n
 
the last line seems to be ignored...

Open in new window

LVL 1
SquadlessAsked:
Who is Participating?
 
CEHJCommented:
>>log4j.appender.myWriterAppender.Name=C:\\temp\\Log.log

should be

log4j.appender.myWriterAppender.file=C:/temp/Log.log
0
 
SquadlessAuthor Commented:
I changed it, getting
log4j:WARN No such property [file] in org.apache.log4j.WriterAppender.
log4j:ERROR No output stream or file set for the appender named [myWriterAppender].
log4j:WARN No such property [file] in org.apache.log4j.WriterAppender.
 
log4j:ERROR No output stream or file set for the appender named [myWriterAppender].

Open in new window

0
 
SquadlessAuthor Commented:
Is there a place where i can see what the tag properties should be... im sure im just missing 1 damn word which woudl solve my issue
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
SquadlessAuthor Commented:
eh i give up... using fileappender ;)
0
 
CEHJCommented:
Sorry - was thinking it was a FileAppender. What are you attaching to your WriterAppender?
0
 
CEHJCommented:
afaik you can't declare a WriterAppender in config - there would be no way of specifying the stream or writer to attach to
0
 
SquadlessAuthor Commented:
Yeah, figured thats what the problem, was... Im just going to use a FileAppender.much simpler

Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.