Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Log4j - hexdump and C style formatting

807601Apr 29 2008 — edited Apr 30 2008
Hi,

call me slow or outdated but I'm C developer for long time, so I'm still using logs as a major tool for debugging...
When using Java I have found great logging Log4j library I'm playing with now.

I have 2 questions to anyone who use it:

*1/ I would like to use C style string formatting with Logger.*
Something like
Logger.warn( "Error %d occurred.", error );
instead of
Logger.warn( "Error " +error+ " occurred." );
Any hints hoe to do it?

*2/ I would like to use classic hex dump like:*
69 6f 6e 2f 72 6c 6d 69 2b 78 6d 6c 0d 0a 0d 0a : ion/rlmi+xml.....
3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 : <?xml version="1.
2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 55 54 : .0" encoding="UT.
46 2d 38 22 3f 3e 3c 6c 69 73 74 20 66 75 6c 6c : F-8"?><list full.
53 74 61 74 65 3d 22 66 61 6c 73 65 22 20 75 72 : State="false" ur.
69 3d 22 73 69 70 3a 78 2b 34 34 33 33 37 37 33 : i="sip:x{code}

Thanks a lot
Best regards
STeN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 28 2008
Added on Apr 29 2008
2 comments
736 views