You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Rick Bonnett <rb...@ascentgl.com> on 2018/09/10 19:44:05 UTC

Cayenne 4 logging

I am struggling to get logging working in version 4 and could use some advice.


My project now has slf4j-log4j and slf4j-api jar files (version 1.7.25). Following the guidance on the slf4j bridge doc, I also created a logback.xml file,


However, I am seeing nothing in my console - which is where I think my logging should be going.

My end goal here is to see the logging from the Cayenne runtime - especially interested in time stamps when JDBC connections are made.


Here's my logback.xml file:


<configuration debug="true">


  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">

    <!-- encoders are assigned the type

         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->

    <encoder>

      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>

    </encoder>

  </appender>


  <root level="all">

    <appender-ref ref="STDOUT" />

  </root>

</configuration>



Any help is greatly appreciated


Thanks


Learn more about Ascent Global Logistics at www.ascentgl.com<http://www.ascentgl.com/>.




[1492612735782_ascentlogo.jpg]

Rick Bonnett


Programmer Analyst
Ascent Global Logistics
Office: 207.620.8670
P.O. Box 1039
Augusta, ME 04332






<https://drive.google.com/uc?id=0B6c1aTLfpRD6OHFVOWw2WUQ1bDg>
[https://ci4.googleusercontent.com/proxy/KSd1y52khHv9agmQvrCbryrM-2fW2_TTiv_ZyM7g8CvIOy1lLeiL98i21qwjj_AtIcK1gmFVa_3klKcL84Nn9soPAtkHRj9nuToKZ86G2yoOSEHDRVJtmcoMmxPmmaYL9i1otg=s0-d-e1-ft#http://cdn2.hubspot.net/hubfs/184235/dev_images/signature_app/facebook_si]

<https://twitter.com/ascent_global>
[https://ci6.googleusercontent.com/proxy/Sh-8YmBCXXgMOdOoPgPtgPnKQjxnBXcEwel_xmwS_cHPKRztClUPBPiJEHPdtG3Hei5hccBS7ONl-N_UCmjOHpHCwBzTomOq7BWdwmxz1KhrziiqbYJgeX4FOXOOh5DEqF8y=s0-d-e1-ft#http://cdn2.hubspot.net/hubfs/184235/dev_images/signature_app/twitter_sig.p]

<https://www.linkedin.com/company/15249966?trk=tyah&trkInfo=clickedVertical%3Acompany%2CclickedEntityId%3A15249966%2Cidx%3A2-1-2%2CtarId%3A1484246260345%2Ctas%3Aascent%20global%20logistics>
[https://ci5.googleusercontent.com/proxy/hzQ50OystqOxlKMduZD32nQoNlmY4n_0V4lxPUWy5nU5cr1gbQR-03vxhbJL7qRILyM-QnaRbLIvZIoxOof999Ep266X82hDAOK2K4jC9rBUhUVgcslhZQ1jOUHJwKu2s6_4sA=s0-d-e1-ft#http://cdn2.hubspot.net/hubfs/184235/dev_images/signature_app/linkedin_si]

<https://www.linkedin.com/company/15249966>
Your Partner for Peak Logistics Performance








The information transmitted is intended only for the person or entity to which it is addressed and may contain proprietary, business-confidential and/or privileged material. If you are not the intended recipient of this message you are hereby notified that any use, review, retransmission, dissemination, distribution, reproduction or any action taken in reliance upon this message is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

Re: Cayenne 4 logging

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Rick,

I don't know what other components you have in your app that may rely directly on various non-SLF loggers (like Log4J or java.util.logging). If you have any, it may complicate the picture. As as far as Cayenne is concerned, it should be very simple though. I don't have much recent experience bridging specifically to Log4J logger, but here is a recipe based on Logback framework. 

Logback is a powerful modern logging framework built by the original Log4J authors. Also Logback already knows about SLF4J, so it does not require extra bridging. So:

1. Include this dependency:

<dependency>
   <groupId>ch.qos.logback</groupId>
   <artifactId>logback-classic</artifactId>
   <version>1.1.11</version>
</dependency>

From here you should already see the logs.

2. To provide custom configuration, place your "logback.xml" file on classpath (e.g. under "src/main/resources" if you are using Maven-like layout). 

This should get you going. Read Logback manual (e.g. [1]) for more advanced configuration and log management.

Thanks,
Andrus 

[1] https://logback.qos.ch/manual/configuration.html

> On Sep 10, 2018, at 10:44 PM, Rick Bonnett <rb...@ascentgl.com> wrote:
> 
> I am struggling to get logging working in version 4 and could use some advice.
> 
> My project now has slf4j-log4j and slf4j-api jar files (version 1.7.25). Following the guidance on the slf4j bridge doc, I also created a logback.xml file,
> 
> However, I am seeing nothing in my console - which is where I think my logging should be going. 
> My end goal here is to see the logging from the Cayenne runtime - especially interested in time stamps when JDBC connections are made.
> 
> Here's my logback.xml file:
> 
> <configuration debug="true">
> 
>   <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
>     <!-- encoders are assigned the type
>          ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
>     <encoder>
>       <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
>     </encoder>
>   </appender>
> 
>   <root level="all">
>     <appender-ref ref="STDOUT" />
>   </root>
> </configuration>
> 
> 
> Any help is greatly appreciated
> 
> Thanks
> 
> Learn more about Ascent Global Logistics at www.ascentgl.com. 
> 
>  
> 
> 
> Rick Bonnett
> Programmer Analyst
> Ascent Global Logistics
> Office: 207.620.8670
> P.O. Box 1039
> Augusta, ME 04332
> 
> 
>        
> 
> Your Partner for Peak Logistics Performance
> 
> 
> 
> The information transmitted is intended only for the person or entity to which it is addressed and may contain proprietary, business-confidential and/or privileged material. If you are not the intended recipient of this message you are hereby notified that any use, review, retransmission, dissemination, distribution, reproduction or any action taken in reliance upon this message is prohibited. If you received this in error, please contact the sender and delete the material from any computer.