Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Tenter de) Faire le ménage dans les logger #91

Open
charbopassman opened this issue Sep 11, 2024 · 1 comment
Open

(Tenter de) Faire le ménage dans les logger #91

charbopassman opened this issue Sep 11, 2024 · 1 comment

Comments

@charbopassman
Copy link
Collaborator

Actuellement pour logger les flux réseaux (TX = transmission / RX = réception), nous utilisons un logger spécifique "TxRxLogger".
A certains endroits on se retrouve avec 3 lignes pour logguer

        ezspDongleLogger.debug(message, frameHandler.getHandlerIdentifier(), ezspTransaction.getRequest());
        txRxLogger.debug(message, frameHandler.getHandlerIdentifier(), ezspTransaction.getRequest());
        logger.debug(message, frameHandler.getHandlerIdentifier(), ezspTransaction.getRequest());

Voir s'il est possible de ne conserver que le "logger" principal. Peut-être que https://logback.qos.ch/manual/appenders.html#SiftingAppender est une solution.

Attention il y a plusieurs utilisations: le mode console et l'app local avec deux fichiers de conf différents. Ci-dessous le fichier log4j utilisé pour la console.

@charbopassman
Copy link
Collaborator Author

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="null" threshold="null">

    <appender class="org.apache.log4j.ConsoleAppender" name="StdOut">
        <param name="Threshold" value="info" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{HH:mm:ss.SSS}  %-5p  %m%n"/>
        </layout>
    </appender>

    <appender class="org.apache.log4j.DailyRollingFileAppender" name="RollingFile">
        <param name="File" value="logs/debug.log" />
        <param name="DatePattern" value="'.'yyyy-MM-dd" />
        <param name="Threshold" value="debug" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{HH:mm:ss.SSS}  %-5p  %m%n"/>
        </layout>
    </appender>
    
    <appender class="org.apache.log4j.DailyRollingFileAppender" name="EzspFile">
        <param name="File" value="logs/ezsp.log" />
        <param name="DatePattern" value="'.'yyyy-MM-dd" />
        <param name="Threshold" value="debug" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{HH:mm:ss.SSS}  %-5p  %m%n"/>
        </layout>
    </appender>

    <logger additivity="true" name="com.zsmartsystems.zigbee">
        <level value="trace"/>
        <appender-ref ref="StdOut" />
    </logger>

    <logger additivity="true" name="com.zsmartsystems.zigbee.dongle.ember">
        <level value="debug"/>
        <appender-ref ref="EzspFile" />
    </logger>

    <!-- utiliser trace au lieu de info pour avoir les trames ASH -->
    <logger additivity="true" name="com.zsmartsystems.zigbee.dongle.ember.internal.ash">
        <level value="info"/>
        <appender-ref ref="EzspFile" />
    </logger>

    <!-- Set the commons logging that the XML parser uses to WARN -->
    <logger name="org.apache.commons">
        <level value="off"/>
    </logger>

    <root>
        <priority value ="debug" />
        <appender-ref ref="RollingFile" />
    </root>

</log4j:configuration>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant