camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "raulvk.soa" <raulvk....@gmail.com>
Subject RE: [SPAM] Re: Custom log messages
Date Tue, 16 Sep 2008 11:05:13 GMT

Yep, I just realised that was possible.

Do you know if there is a way to get rid of the full category name and only
print out the last token on the log file? i.e. print out
"ValidatingAgainstXMLSchema" instead of
"com.mycompany.ValidatingAgainstXMLSchema".

I am aware that I can truncate it at a fixed position, but I cannot
guarantee that my final tokens will all be the same length...



Claus Ibsen wrote:
> 
> Hi
> 
> You can prefix the categoy (package name) with the same prefix
> 
> To("log:com.mycompany.ValidatingAgainstXMLSchema")
> To("log:com.mycompany.ValidationOK")
> 
> And have them logged in the same file
> 
> log4j.logger.com.mycompany = special
> 
> log4j.appender.special=org.apache.log4j.FileAppender
> log4j.appender.special.layout=org.apache.log4j.PatternLayout
> log4j.appender.special.layout.ConversionPattern=%d [%-15.15t] %-5p
> %-30.30c{1} - %m%n
> log4j.appender.special.file=myspecial.log
> log4j.appender.special.append=true
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: James Strachan [mailto:james.strachan@gmail.com] 
> Sent: 16. september 2008 12:34
> To: camel-user@activemq.apache.org
> Subject: [SPAM] Re: Custom log messages
> 
> 2008/9/16 raulvk.soa <raulvk.soa@gmail.com>:
>> Nevermind. Sorry I got confused. Obviously you can make different log
>> categories use the same Appender!
>>
>> That would be a temporary solution, as architecturally speaking we would
>> be
>> overloading the log4j with an awful amount of loggers, which I am not
>> happy
>> doing.
>>
>> Do you think it is feasible to achieve this by extending the Logger class
>> and using it as a processor? What method would I have to override? Any
>> special considerations? I think I may attempt to do this...
> 
> I'm not quite sure I follow. Claus's example uses a single Logger
> called "ValidatingAgainstXMLSchema" or whatever. i.e. you can use a
> single Logger if you want - the URI log:foo defines the logger to use.
> There's not one per message or anything like that. Each different log
> URI uses a different logger, so its up to you to define how many
> different logger/categories you want to use.
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Custom-log-messages-tp19508418s22882p19509593.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message