I read about this method in thelog4j documentation, but I'm using the logger of the class MyEndpoint created by the maven archetype... MyEndpoint extends Endpoint and gets the logger in the activate() method:
logger = this.serviceUnit.getComponent().getLogger(); tterm wrote: > > Doesn't you give the name of the logger in your code/class? > > I thought you mean that you have a class which get a logger like > Log logger = LogFactory.getLogger(LoggerName) > > And for all this classes where you create a new logger you can declare > different appender for all specific logger. > > But maybe I don't see the right point of your view. > > Cheers, > Thomas > > beppe82 wrote: >> Doesn't the name of the logger correspond to the namespace of the SU >> which >> uses it? If I name my "toxml" logger just "xml" and not "cedac.xml" (the >> namespace of the SU), servicemix create the file but print the log in the >> console... so, if I have multiple SU in the same namespace, I can't have >> multiple loggers with the same name.... isn't that right? >> Thanks >> >> >> tterm wrote: >> >>>beppe82 wrote: >>> >>>>Thank you very much! I really appreciate you all take lot of time helping >>>>newbies like me! Giuseppe >>>> >>>>P.S.: Now, I have several SU which belongs to the same namespace, but I >>>>would like to have differente logs... is it possibile or I must change >>>>namespaces? >>> >>>I don't see how it belongs to namespaces. >>> >>>Choose different Logger names (logger) and for that add different >>>appender. >>> >>>Cheers, >>>Thomas >>> >>> >>> >>>> >>>>tterm wrote: >>>> >>>> >>>>>Remove the appender from the root logger and add it to your logger. >>>>> >>>>>beppe82 wrote: >>>>> >>>>> >>>>>>Did another mistake, now it creates the file, but the problem remains: >> >> it >> >>>>>>prints all the "stuff" from service mix environment! See the attached >>>>>>file. >>>>>>Thanks a lot for yout help >> >> http://www.nabble.com/file/p11445069/log4j.xml >> >>>>>>log4j.xml >>>>>> >>>>>> >>>>>> >>>>>>tterm wrote: >>>>>> >>>>>> >>>>>> >>>>>>>Did you forget the appender-ref? >>>>>>> >>>>>>><logger name="cedac.xml" additivity="false"> >>>>>>> <level value="INFO"/> >>>>>>> <appender-ref ref="TOXML"/> >>>>>>></logger> >>>>>>> >>>>>>> >>>>>>>beppe82 wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>>>I got the following error.... >>>>>>>> >>>>>>>>log4j:WARN No appenders could be found for logger >>>>>>>>(cedac.xml.MyComponent). >>>>>>>>log4j:WARN Please initialize the log4j system properly. >>>>>>>> >>>>>>>>I think the error is here, but I never used log4j before, so I don't >>>>>>>>exactly >>>>>>>>know what I'm doing :( >>>>>>>> >>>>>>>><appender name="TOXML" class="org.apache.log4j.FileAppender"> >>>>>>>> >>>>>>>> >>>>>>>> <layout class="org.apache.log4j.PatternLayout"> >>>>>>>> >>>>>>>> </layout> >>>>>>>> </appender> >>>>>>>> >>>>>>>> >>>>>>>>tterm wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>>You missed the additivity flag >>>>>>>>> >>>>>>>>>You can add this on all your loggers. >>>>>>>>> >>>>>>>>><logger name="cedac.xml" additivity="false"> >>>>>>>>> <level value="INFO"/> >>>>>>>>></logger> >>>>>>>>> >>>>>>>>>Cheers, >>>>>>>>>Thomas Termin >>>>>>>>> >>>>>>>>>beppe82 wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>I'm sorry, can you help me doing that? I tried to create the >> >> following >> >>>>>>>>>>new >>>>>>>>>>entries to have a dedicated logger for cedac.xml component. It >> >> prints >> >>>>>>the >>>>>> >>>>>> >>>>>> >>>>>>>>>>message I log, but it prints also all the other stuff logged by >>>>>>>>>>servicemix... thanks >>>>>>>>>> >>>>>>>>>><log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" >>>>>>>>>>debug="false"> >>>>>>>>>> >>>>>>>>>> <appender name="CONSOLE" >>>>>>>>>> class="org.apache.log4j.ConsoleAppender"> >>>>>>>>>> >>>>>>>>>> <layout class="org.apache.log4j.PatternLayout"> >>>>>>>>>> >>>>>>>>>> </layout> >>>>>>>>>> </appender> >>>>>>>>>> >>>>>>>>>> <appender name="FILE" class="org.apache.log4j.FileAppender"> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> <layout class="org.apache.log4j.PatternLayout"> >>>>>>>>>> >>>>>>>>>> </layout> >>>>>>>>>> </appender> >>>>>>>>>> >>>>>>>>>> <!-- Configurazione per LOG Cedac --> >>>>>>>>>> <appender name="TOXML" class="org.apache.log4j.FileAppender"> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> <layout class="org.apache.log4j.PatternLayout"> >>>>>>>>>> >>>>>>>>>> </layout> >>>>>>>>>> </appender> >>>>>>>>>> <!-- FINE --> >>>>>>>>>> >>>>>>>>>> <logger name="org.apache"> >>>>>>>>>> <level value="WARN"/> >>>>>>>>>> </logger> >>>>>>>>>> <logger name="org.springframework"> >>>>>>>>>> <level value="WARN"/> >>>>>>>>>> </logger> >>>>>>>>>> <logger name="org.jencks"> >>>>>>>>>> <level value="WARN"/> >>>>>>>>>> </logger> >>>>>>>>>> <logger name="org.apache.activemq"> >>>>>>>>>> <level value="WARN"/> >>>>>>>>>> </logger> >>>>>>>>>> <logger name="org.apache.activemq.transport.discovery"> >>>>>>>>>> <level value="ERROR"/> >>>>>>>>>> </logger> >>>>>>>>>> <logger name="org.apache.servicemix"> >>>>>>>>>> <!-- To enable debug logging, replace the INFO by DEBUG --> >>>>>>>>>> <level value="INFO"/> >>>>>>>>>> </logger> >>>>>>>>>> <logger name="org.apache.servicemix.jbi.config"> >>>>>>>>>> <level value="WARN"/> >>>>>>>>>> </logger> >>>>>>>>>> <logger name="org.apache.servicemix.jbi.deployment"> >>>>>>>>>> <level value="WARN"/> >>>>>>>>>> </logger> >>>>>>>>>> >>>>>>>>>> <!-- Configurazione per LOG Cedac --> >>>>>>>>>> <logger name="cedac.xml"> >>>>>>>>>> <level value="INFO"/> >>>>>>>>>> </logger> >>>>>>>>>> <!-- FINE --> >>>>>>>>>> >>>>>>>>>> <root> >>>>>>>>>> <level value="INFO"/> >>>>>>>>>> <appender-ref ref="CONSOLE"/> >>>>>>>>>> <appender-ref ref="FILE"/> >>>>>>>>>> <appender-ref ref="TOXML"/> >>>>>>>>>> </root> >>>>>>>>>> >>>>>>>>>></log4j:configuration> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>tterm wrote: >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>>You have to configure this in conf/log4j.xml. >>>>>>>>>>> >>>>>>>>>>>You can of course have different appenders (with different files) >> >> for >> >>>>>>>>>>>different categories. >>>>>>>>>>> >>>>>>>>>>>Cheers >>>>>>>>>>>Thomas Termin >>>>>>>>>>> >>>>>>>>>>>beppe82 wrote: >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>>Hi, is it possible to have different loggers for each component? I >>>>>> >>>>>>mean, >>>>>> >>>>>> >>>>>> >>>>>>>>>>>>I >>>>>>>>>>>>don't care of tracing messages (eip-wire-tap), I would just like >>>> >>>>each >>>> >>>> >>>>>>>>>>>>component to write something like "I received a message, here it >>>>>>>>>>>>is:....". >>>>>>>>>>>>I tried to use logger.info(....), but the log is written into >>>>>>>>>>>>servicemix.log >>>>>>>>>>>>in the data\log directory, while I would like to have se1.log, >>>> >>>>se2.log >>>> >>>> >>>>>>>>>>>>and >>>>>>>>>>>>so on. >>>>>>>>>>>>Thanks, Giuseppe >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>-- >>>>>>>>>>>Thomas Termin >>>>>>>>>>>_______________________________ >>>>>>>>>>>blue elephant systems GmbH >>>>>>>>>>>Wollgrasweg 49 >>>>>>>>>>>D-70599 Stuttgart >>>>>>>>>>> >>>>>>>>>>>Tel : (+49) 0711 - 45 10 17 676 >>>>>>>>>>>Fax : (+49) 0711 - 45 10 17 573 >>>>>>>>>>>WWW : http://www.blue-elephant-systems.com >>>>>>>>>>>Email : [EMAIL PROTECTED] >>>>>>>>>>> >>>>>>>>>>>blue elephant systems GmbH >>>>>>>>>>>Firmensitz : Wollgrasweg 49, D-70599 Stuttgart >>>>>>>>>>>Registergericht : Amtsgericht Stuttgart, HRB 24106 >>>>>>>>>>>GeschÀftsfÌhrer : Holger Dietrich, Thomas Gentsch, Joachim >> >> Hoernle >> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>-- >>>>>>>>>Thomas Termin >>>>>>>>>_______________________________ >>>>>>>>>blue elephant systems GmbH >>>>>>>>>Wollgrasweg 49 >>>>>>>>>D-70599 Stuttgart >>>>>>>>> >>>>>>>>>Tel : (+49) 0711 - 45 10 17 676 >>>>>>>>>Fax : (+49) 0711 - 45 10 17 573 >>>>>>>>>WWW : http://www.blue-elephant-systems.com >>>>>>>>>Email : [EMAIL PROTECTED] >>>>>>>>> >>>>>>>>>blue elephant systems GmbH >>>>>>>>>Firmensitz : Wollgrasweg 49, D-70599 Stuttgart >>>>>>>>>Registergericht : Amtsgericht Stuttgart, HRB 24106 >>>>>>>>>GeschÀftsfÌhrer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>-- >>>>>>>Thomas Termin >>>>>>>_______________________________ >>>>>>>blue elephant systems GmbH >>>>>>>Wollgrasweg 49 >>>>>>>D-70599 Stuttgart >>>>>>> >>>>>>>Tel : (+49) 0711 - 45 10 17 676 >>>>>>>Fax : (+49) 0711 - 45 10 17 573 >>>>>>>WWW : http://www.blue-elephant-systems.com >>>>>>>Email : [EMAIL PROTECTED] >>>>>>> >>>>>>>blue elephant systems GmbH >>>>>>>Firmensitz : Wollgrasweg 49, D-70599 Stuttgart >>>>>>>Registergericht : Amtsgericht Stuttgart, HRB 24106 >>>>>>>GeschÀftsfÌhrer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>-- >>>>>Thomas Termin >>>>>_______________________________ >>>>>blue elephant systems GmbH >>>>>Wollgrasweg 49 >>>>>D-70599 Stuttgart >>>>> >>>>>Tel : (+49) 0711 - 45 10 17 676 >>>>>Fax : (+49) 0711 - 45 10 17 573 >>>>>WWW : http://www.blue-elephant-systems.com >>>>>Email : [EMAIL PROTECTED] >>>>> >>>>>blue elephant systems GmbH >>>>>Firmensitz : Wollgrasweg 49, D-70599 Stuttgart >>>>>Registergericht : Amtsgericht Stuttgart, HRB 24106 >>>>>GeschÀftsfÌhrer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle >>>>> >>>>> >>>>> >>>> >>>> >>> >>>-- >>>Thomas Termin >>>_______________________________ >>>blue elephant systems GmbH >>>Wollgrasweg 49 >>>D-70599 Stuttgart >>> >>>Tel : (+49) 0711 - 45 10 17 676 >>>Fax : (+49) 0711 - 45 10 17 573 >>>WWW : http://www.blue-elephant-systems.com >>>Email : [EMAIL PROTECTED] >>> >>>blue elephant systems GmbH >>>Firmensitz : Wollgrasweg 49, D-70599 Stuttgart >>>Registergericht : Amtsgericht Stuttgart, HRB 24106 >>>GeschÀftsfÌhrer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle >>> >>> >>> >> >> > > > -- > Thomas Termin > _______________________________ > blue elephant systems GmbH > Wollgrasweg 49 > D-70599 Stuttgart > > Tel : (+49) 0711 - 45 10 17 676 > Fax : (+49) 0711 - 45 10 17 573 > WWW : http://www.blue-elephant-systems.com > Email : [EMAIL PROTECTED] > > blue elephant systems GmbH > Firmensitz : Wollgrasweg 49, D-70599 Stuttgart > Registergericht : Amtsgericht Stuttgart, HRB 24106 > GeschÀftsfÌhrer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle > > > -- View this message in context: http://www.nabble.com/logger-tf4028912s12049.html#a11445966 Sent from the ServiceMix - User mailing list archive at Nabble.com.
