Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Bogus Exception - 09 Nov 2006 17:26 GMT
...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!!!
Arne Vajhøj - 09 Nov 2006 17:50 GMT
> ...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
Bogus Exception - 09 Nov 2006 18:42 GMT
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
:)

Arne Vajh?j wrote:
> > ...or to be more precise, how to write only data (payload) to the log4j
> > appender...
[quoted text clipped - 8 lines]
>
> Arne
Daniel Pitts - 10 Nov 2006 00:55 GMT
> Arne,
>
[quoted text clipped - 28 lines]
> >
> > Arne

Perhaps there is whitespace after your %n?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.