Add JPOS log to Spring Boot log

750 views
Skip to first unread message

LengZai

unread,
Jan 8, 2018, 4:32:35 AM1/8/18
to jPOS Users


Hi guys, currently I using SpringBoot as my project framework. 

application.properties


logging
.level.root=INFO
logging
.config =classpath:logback-spring.xml


logback-spring

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

   
<property name="HOME" value="./logs" />
   
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender">
       
<syslogHost>10.0.3.20</syslogHost>
       
<facility>SYSLOG</facility>
       
<suffixPattern>sample[%thread] %logger %msg</suffixPattern>
   
</appender>

   
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
       
<layout class="ch.qos.logback.classic.PatternLayout">
           
<Pattern>
                %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
           
</Pattern>
       
</layout>
   
</appender>


   
<appender name="FILE-AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender">

       
<file>${HOME}/sample.log</file>
       
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
           
<Pattern>
                %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %msg%n
           
</Pattern>
       
</encoder>

       
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
           
<fileNamePattern>
                ${HOME}/sample.%d{dd-MM-yyyy}.log
           
</fileNamePattern>
       
</rollingPolicy>
   
</appender>

   
<logger name="com.rh.sample" level="debug">
       
<appender-ref ref="STDOUT" />
       
<appender-ref ref="SYSLOG" />
       
<appender-ref ref="FILE-AUDIT" />
   
</logger>

</configuration>


And I have logger.xml in deploy folder

<?xml version="1.0" encoding="UTF-8"?>


<logger name="Q2" class="org.jpos.q2.qbean.LoggerAdaptor">
   
<log-listener class="org.jpos.util.ProtectedLogListener">
       
<property name="protect" value="2 36 52"/>
   
</log-listener>
   
<log-listener class="org.jpos.util.RotateLogListener">
       
<property name="file" value="logs/sample.log"/>
       
<property name="window" value="86400"/>
       
<property name="copies" value="5"/>
       
<property name="maxsize" value="5000000000"/>
   
</log-listener>
   
<log-listener class="com.rh.sample.iso.LogListener">
       
<property name="file" value="logs/sample.log"/>
       
<property name="linefeed" value="false"/>
       
<property name="timezone" value="8"/>
       
<property name="priority" value="trace"/>
   
</log-listener>
   
<log-listener class="org.jpos.util.SimpleLogListener"/>
</logger>


Is there a way I can save all the JPOS transaction to spring boot log? 
Thanks.

Victor Salaman

unread,
Jan 8, 2018, 10:19:02 AM1/8/18
to jpos-...@googlegroups.com
Hi:

I think you are over-complicating your config. 

One way to achieve what you are trying to do is to create (or use mine) a simple log listener that simply bridges to Spring Boot. You can find an example at: https://github.com/vmantek/chimera/blob/master/src/main/java/com/vmantek/chimera/logging/ChimeraLogListener.java

Then just add the log listener to the 00_logger.xml on your jPOS Q2 side!

Happy travels,

/V

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/c114473e-aeeb-4023-be43-f1a5672b91bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tony Seng

unread,
Jan 8, 2018, 8:35:05 PM1/8/18
to jpos-...@googlegroups.com
Hi, thanks for the reply.
But what if I want to add all JPOS log into the SpringBoot log file ?


You received this message because you are subscribed to a topic in the Google Groups "jPOS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jpos-users/6wE_Ekls7mE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Whatever you are , be a good one.

Victor Salaman

unread,
Jan 9, 2018, 1:23:16 AM1/9/18
to jpos-...@googlegroups.com
Hello:

With this approch you are sending the entire jpos log to Spring Boot.

/V

Reply all
Reply to author
Forward
0 new messages