[log4j] How to write nothing to the log...

  • Thread starter Bogus Exception
  • Start date
B

Bogus Exception

....or to be more precise, how to write only data (payload) to the log4j
appender...

I want all the benefits of log4j, but none of the seemingly required
overhead of ConversionPattern variables. In other words, I want to
control every single byte that is written, with nothing added by log4j.

This will not work:

[...]
log4j.appender.A3=org.apache.log4j.FileAppender
log4j.appender.A3.File=logs/some.log
log4j.appender.A3.Append=false
log4j.appender.A3.layout=org.apache.log4j.PatternLayout
log4j.appender.A3.layout.ConversionPattern=

but this, expectedly, will:
[...]
log4j.appender.A3.layout.ConversionPattern=%d{yyyyddMMHHmmss} [%c{1}]
%p - %m%n

Perhaps the PatternLayout is not the right choice?

I can't find a combination in log4j that will simply allow me to write
anything I want to the appender, but WITHOUT anything extra.

TIA!!!
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Bogus said:
...or to be more precise, how to write only data (payload) to the log4j
appender...

I want all the benefits of log4j, but none of the seemingly required
overhead of ConversionPattern variables. In other words, I want to
control every single byte that is written, with nothing added by log4j.

log4j.appender.A3.layout.ConversionPattern=%m%n

maybe ?

Arne
 
B

Bogus Exception

Arne,

I have no explanation. This works good enough. Thanks!!! I tried this
last night, and got no output. I think I was getting tired and hitting
the same keys over and over!

Why "good enough"? Well, log4j does something strange when I do this.
And by this I mean:

log4j.appender.A3.layout.ConversionPattern=%m%n

In the first line written to the log, the characters start at the first
column. BUT, every subsequent line is written starting at the second
column! I can get around that easily enough!

Thanks again!

BogusException
:)
 
D

Daniel Pitts

Bogus said:
Arne,

I have no explanation. This works good enough. Thanks!!! I tried this
last night, and got no output. I think I was getting tired and hitting
the same keys over and over!

Why "good enough"? Well, log4j does something strange when I do this.
And by this I mean:

log4j.appender.A3.layout.ConversionPattern=%m%n

In the first line written to the log, the characters start at the first
column. BUT, every subsequent line is written starting at the second
column! I can get around that easily enough!

Thanks again!

BogusException
:)

Perhaps there is whitespace after your %n?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top