You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by James Green <ja...@gmail.com> on 2015/01/13 11:17:15 UTC

Where is logName used?

The following code:

                .log(LoggingLevel.ERROR, "com.foo.server.ngw.router",
"Account Not Found. Message discarded.").stop();

Results in the following in the log:

10:12:11,690 ERROR org.slf4j.helpers.MarkerIgnoringBase:145 error() -
Account Not Found. Message discarded.

I was expecting to see com.foo.server.ngw.router somewhere above? Not sure
what else it is supplied for..?

James

Re: Where is logName used?

Posted by James Green <ja...@gmail.com>.
We just upgraded to log4j2. We are logging via slf4j.

Given:
        onException(AccountNotFoundException.class).log(LoggingLevel.WARN,
"com.foo.server.ngw", "Account not found");

We see in the Tomcat log:
2015-01-16 10:45:07,357 WARN  [http-bio-8080-exec-1]
org.apache.camel.util.CamelLogger (CamelLogger.java:182) - Account not found

Not sure what that tells you quite frankly. We did previously use log()
handing in our own org.slf4j.Logger without further success.


On 16 January 2015 at 06:30, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Kinda weird as that log name refers to the slf4j marker which you can
> also use. Are you sure the log() method you use, its the logger name
> and not some marker parameter?
>
> Also you do not use any custom logger instance, as if so then that is
> used over what you specify in the log method,.
>
> https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java#L55
>
>
> On Tue, Jan 13, 2015 at 11:17 AM, James Green <ja...@gmail.com>
> wrote:
> > The following code:
> >
> >                 .log(LoggingLevel.ERROR, "com.foo.server.ngw.router",
> > "Account Not Found. Message discarded.").stop();
> >
> > Results in the following in the log:
> >
> > 10:12:11,690 ERROR org.slf4j.helpers.MarkerIgnoringBase:145 error() -
> > Account Not Found. Message discarded.
> >
> > I was expecting to see com.foo.server.ngw.router somewhere above? Not
> sure
> > what else it is supplied for..?
> >
> > James
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
>

Re: Where is logName used?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Kinda weird as that log name refers to the slf4j marker which you can
also use. Are you sure the log() method you use, its the logger name
and not some marker parameter?

Also you do not use any custom logger instance, as if so then that is
used over what you specify in the log method,.
https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java#L55


On Tue, Jan 13, 2015 at 11:17 AM, James Green <ja...@gmail.com> wrote:
> The following code:
>
>                 .log(LoggingLevel.ERROR, "com.foo.server.ngw.router",
> "Account Not Found. Message discarded.").stop();
>
> Results in the following in the log:
>
> 10:12:11,690 ERROR org.slf4j.helpers.MarkerIgnoringBase:145 error() -
> Account Not Found. Message discarded.
>
> I was expecting to see com.foo.server.ngw.router somewhere above? Not sure
> what else it is supplied for..?
>
> James



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Where is logName used?

Posted by James Green <ja...@gmail.com>.
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{ABSOLUTE} %5p %C:%L %M()
- %m%n
### set log levels - for more verbose logging change 'info' to 'debug' ###
log4j.rootLogger=debug, console
log4j.logger.org=warn
log4j.logger.com=warn
log4j.logger.com.example=debug
log4j.logger.org.hibernate=warn
log4j.logger.org.springframework.transaction=warn
log4j.logger.com.foo=debug

Not much I can really say about that except it's a variant of what is
widely given as basic examples.

Does this help explain why the logName is not used at all?


On 14 January 2015 at 14:06, Willem Jiang <wi...@gmail.com> wrote:

> The “com.foo.server.ngw.router” is the log name to use, I’m not sure why
> the “org.slf4j.helpers.MarkerIgnoringBase” is used. Can you double check
> your log configuration to make sure you setup the log rightly?
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
> On January 13, 2015 at 6:17:48 PM, James Green (james.mk.green@gmail.com)
> wrote:
> > The following code:
> >
> > .log(LoggingLevel.ERROR, "com.foo.server.ngw.router",
> > "Account Not Found. Message discarded.").stop();
> >
> > Results in the following in the log:
> >
> > 10:12:11,690 ERROR org.slf4j.helpers.MarkerIgnoringBase:145 error() -
> > Account Not Found. Message discarded.
> >
> > I was expecting to see com.foo.server.ngw.router somewhere above? Not
> sure
> > what else it is supplied for..?
> >
> > James
> >
>
>

Re: Where is logName used?

Posted by Willem Jiang <wi...@gmail.com>.
The “com.foo.server.ngw.router” is the log name to use, I’m not sure why the “org.slf4j.helpers.MarkerIgnoringBase” is used. Can you double check your log configuration to make sure you setup the log rightly?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 13, 2015 at 6:17:48 PM, James Green (james.mk.green@gmail.com) wrote:
> The following code:
>  
> .log(LoggingLevel.ERROR, "com.foo.server.ngw.router",
> "Account Not Found. Message discarded.").stop();
>  
> Results in the following in the log:
>  
> 10:12:11,690 ERROR org.slf4j.helpers.MarkerIgnoringBase:145 error() -
> Account Not Found. Message discarded.
>  
> I was expecting to see com.foo.server.ngw.router somewhere above? Not sure
> what else it is supplied for..?
>  
> James
>