You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Martin Stiborský <ma...@gmail.com> on 2012/10/22 21:03:04 UTC

Logging level for Spring framework

Hello,
I have troubles with logging from a bean class that is injected to an
another class.
>From the injected one, I can't see any log messages in the log file,
whereas from other classes (which are used in a route somehow with
beanRef for example)  there the logging works without problems.

I was trying to change log level for spring framework, but it doesn't helped.

etc/org.ops4j.pax.logging.cfg

log4j.logger.org.springframework=DEBUG, myCustomAppender

What am I missing?

Thanks guys!

-- 
S pozdravem
Martin Stiborský

Jabber: stibi@njs.netlab.cz

Re: Logging level for Spring framework

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Oct 26, 2012 at 9:57 AM, Martin Stiborský
<ma...@gmail.com> wrote:
> :D now it's working, I don't know what changed…
>
> Crazy, I need a break I guess…
>

Did you restart the server. You use Karaf I can see and sometimes
restarting it "fixes" weird issues.


> On Tue, Oct 23, 2012 at 7:22 PM, Martin Stiborský
> <ma...@gmail.com> wrote:
>> Hello,
>>
>> On Mon, Oct 22, 2012 at 9:18 PM, Hilde <hi...@yahoo.de> wrote:
>>> Hello,
>>>
>>> why do you incorporate
>>>
>>> log4j.logger.org.springframework= ...
>>>
>>> instead of
>>>
>>> log4j.logger.my.injected.bean.namespace=...
>>>
>>
>> Yep…believe me, I tried that, I have there explicitely the package
>> with log level a specified appender, no help.
>> There have to be something really stupid as my mistake, but I can't
>> find it, because I have there injected also another, dummy class, and
>> there the logging is working.
>>
>>
>>
>> --
>> S pozdravem
>> Martin Stiborský
>>
>> Jabber: stibi@njs.netlab.cz
>
>
>
> --
> S pozdravem
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Logging level for Spring framework

Posted by Martin Stiborský <ma...@gmail.com>.
:D now it's working, I don't know what changed…

Crazy, I need a break I guess…

On Tue, Oct 23, 2012 at 7:22 PM, Martin Stiborský
<ma...@gmail.com> wrote:
> Hello,
>
> On Mon, Oct 22, 2012 at 9:18 PM, Hilde <hi...@yahoo.de> wrote:
>> Hello,
>>
>> why do you incorporate
>>
>> log4j.logger.org.springframework= ...
>>
>> instead of
>>
>> log4j.logger.my.injected.bean.namespace=...
>>
>
> Yep…believe me, I tried that, I have there explicitely the package
> with log level a specified appender, no help.
> There have to be something really stupid as my mistake, but I can't
> find it, because I have there injected also another, dummy class, and
> there the logging is working.
>
>
>
> --
> S pozdravem
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz



-- 
S pozdravem
Martin Stiborský

Jabber: stibi@njs.netlab.cz

Re: Logging level for Spring framework

Posted by Martin Stiborský <ma...@gmail.com>.
Hello,

On Mon, Oct 22, 2012 at 9:18 PM, Hilde <hi...@yahoo.de> wrote:
> Hello,
>
> why do you incorporate
>
> log4j.logger.org.springframework= ...
>
> instead of
>
> log4j.logger.my.injected.bean.namespace=...
>

Yep…believe me, I tried that, I have there explicitely the package
with log level a specified appender, no help.
There have to be something really stupid as my mistake, but I can't
find it, because I have there injected also another, dummy class, and
there the logging is working.



-- 
S pozdravem
Martin Stiborský

Jabber: stibi@njs.netlab.cz

Re: Logging level for Spring framework

Posted by Hilde <hi...@yahoo.de>.
Hello,

why do you incorporate

log4j.logger.org.springframework= ...

instead of

log4j.logger.my.injected.bean.namespace=...

?

Cheers
Hilde



--
View this message in context: http://camel.465427.n5.nabble.com/Logging-level-for-Spring-framework-tp5721413p5721414.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Logging level for Spring framework

Posted by Martin Stiborský <ma...@gmail.com>.
There have to be some reeeally stupid mistake done by me.
I tried to create another "dummy" class, inject it similar as is the
problematic one and logging works for the dummy one.
Only the specific one is still silent.

Here is the logging configuration. Of course I tried to setup camel
rootLogger to DEBUG, but the problem was still there.

# Root logger
log4j.rootLogger=INFO, out, osgi:*
log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer
log4j.logger.myproject=DEBUG, myproject

# Myproject appender
log4j.appender.myproject=org.apache.log4j.sift.MDCSiftingAppender
log4j.appender.myproject.key=camel.contextId
log4j.appender.myproject.default=unknown
log4j.appender.myproject.appender=org.apache.log4j.RollingFileAppender
log4j.appender.myproject.appender.layout=org.apache.log4j.PatternLayout
log4j.appender.myproject.appender.layout.ConversionPattern=%d{ABSOLUTE}
| %-5.5p | %X{camel.routeId} %X{bundle.version} | %m%n
log4j.appender.myproject.appender.file=${karaf.data}/log/myproject-$\\{camel.contextId\\}.log
log4j.appender.myproject.appender.append=true
log4j.appender.myproject.appender.maxFileSize=1MB
log4j.appender.myproject.appender.maxBackupIndex=10

All other configuration org.ops4j.pax.logging.cfg remained not touched.

On Mon, Oct 22, 2012 at 11:06 PM, Christian Müller
<ch...@gmail.com> wrote:
> Could you share the complete logging configuration.
>
> Sent from a mobile device
> Am 22.10.2012 21:03 schrieb "Martin Stiborský" <ma...@gmail.com>:
>
>> Hello,
>> I have troubles with logging from a bean class that is injected to an
>> another class.
>> From the injected one, I can't see any log messages in the log file,
>> whereas from other classes (which are used in a route somehow with
>> beanRef for example)  there the logging works without problems.
>>
>> I was trying to change log level for spring framework, but it doesn't
>> helped.
>>
>> etc/org.ops4j.pax.logging.cfg
>>
>> log4j.logger.org.springframework=DEBUG, myCustomAppender
>>
>> What am I missing?
>>
>> Thanks guys!
>>
>> --
>> S pozdravem
>> Martin Stiborský
>>
>> Jabber: stibi@njs.netlab.cz
>>



-- 
S pozdravem
Martin Stiborský

Jabber: stibi@njs.netlab.cz

Re: Logging level for Spring framework

Posted by Christian Müller <ch...@gmail.com>.
Could you share the complete logging configuration.

Sent from a mobile device
Am 22.10.2012 21:03 schrieb "Martin Stiborský" <ma...@gmail.com>:

> Hello,
> I have troubles with logging from a bean class that is injected to an
> another class.
> From the injected one, I can't see any log messages in the log file,
> whereas from other classes (which are used in a route somehow with
> beanRef for example)  there the logging works without problems.
>
> I was trying to change log level for spring framework, but it doesn't
> helped.
>
> etc/org.ops4j.pax.logging.cfg
>
> log4j.logger.org.springframework=DEBUG, myCustomAppender
>
> What am I missing?
>
> Thanks guys!
>
> --
> S pozdravem
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz
>

Re: Logging level for Spring framework

Posted by Magnus Palmér <ma...@gmail.com>.
The log4j config you shared only tells us what log level you have
configured for org.springframework classes.
I assume your bean doesn't belong to that package.

So, what log level is the rootLogger at, what package does your bean class
belong to that doesn't log, how is your myCustomAppender configured.
Perhaps you could just try:
log4j.logger.<package-name>=DEBUG

You could also turn on debug on log4j and see how it configures your
logging.
-Dlog4j.debug=true


2012/10/22 Martin Stiborský <ma...@gmail.com>

> Hello,
> I have troubles with logging from a bean class that is injected to an
> another class.
> From the injected one, I can't see any log messages in the log file,
> whereas from other classes (which are used in a route somehow with
> beanRef for example)  there the logging works without problems.
>
> I was trying to change log level for spring framework, but it doesn't
> helped.
>
> etc/org.ops4j.pax.logging.cfg
>
> log4j.logger.org.springframework=DEBUG, myCustomAppender
>
> What am I missing?
>
> Thanks guys!
>
> --
> S pozdravem
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz
>