disable stderr, stdout logs from jpos logs

201 views
Skip to first unread message

netma...@gmail.com

unread,
Dec 5, 2018, 3:33:16 AM12/5/18
to jPOS Users
Hi,

I am getting so many stdout and stderr logs, in jpos log file. e.g.

<log realm="stderr" at="2018-12-05T13:55:14.529" lifespan="500ms">
    Dec 05, 2018 1:55:14 PM org.hibernate.dialect.Dialect <init>
    INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
    Dec 05, 2018 1:55:14 PM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl useContextualLobCreation
    INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
    Dec 05, 2018 1:55:14 PM org.hibernate.envers.boot.internal.EnversServiceImpl configure
    INFO: Envers integration enabled? : true
    Dec 05, 2018 1:55:14 PM org.hibernate.mapping.RootClass checkCompositeIdentifier
    WARN: HHH000038: Composite-id class does not override equals(): com.start.dao.model.pk.testPk
    Dec 05, 2018 1:55:14 PM org.hibernate.mapping.RootClass checkCompositeIdentifier
    WARN: HHH000039: Composite-id class does not override hashCode(): com.start.dao.model.pk.testPk
</log>

How can i disable such logs?





Alejandro Revilla

unread,
Dec 5, 2018, 8:02:02 AM12/5/18
to jPOS Users

I NetMagicPrd,

jPOS has the ability to redirect stdout and stderr to its logger. You enable that in deploy/00_logger.xml with the property:

<property name="redirect" value="stdout, stderr" />

You can remove that line and those log messages will go to the regular stdout and stderr, or you can redirect them at the operating system level, but what you probably want is to configure log4j (used by Hibernate) to change the level perhaps from INFO to WARN (you probably still want to see those WARNs).

You can do that by setting a log4j.properties file in your CLASSPATH, or by using jPOS-EE logback module. The logback module is configured like this:

<logback name="logback-config" class="org.jpos.logging.logback.LogbackConfigurator">
    <property name="config-resource" value="file:cfg/logback.xml"/>
</logback>

Then in your logback.xml file you can set something like this:

<configuration scan="true" scanPeriod="30 seconds">

    <!-- 'Q2' Appender -->
    <appender name="Q2" class="org.jpos.logging.logback.LogbackAppender"/>

    <!-- By default all messages at level ERROR will go to the 'Q2' appender -->
    <root level="ERROR">
        <appender-ref ref="Q2"/>
    </root>
</configuration>

Interesting enough, those sample files are available in the logback module as a resource, so if you are using Gradle and jPOS file structure (as we do in the jPOS-Template project), you can try gradle installResources and the files will be created for you in the src/dist directory.

Hope this helps.



--
--
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+...@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/c8e9555f-0503-4a93-bb7d-e8598745be9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages