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 <rbonn...@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.

Reply via email to