5 Replies Latest reply on Jul 13, 2016 11:03 AM by Sajid Patel RSS
    pnali Explorer

    Disabling of log file in EMS

    In the existing SDK EMS, is it possible to disable the log file that we are getting on the console while running the EMS.

      • Re: Disabling of log file in EMS
        aanjan Heavyweight Champ

        Preethi, is this related to the Edge MicroServer? You can set the logger flags to WARN or ERROR in the config.json to display minimal information. Here's an example -

        "logger":    {
           "level":"WARN",
           "auto_flush":true

            }

         

        If you have the EMS running as a service, once it starts, you won't even see the console window.

        • Re: Disabling of log file in EMS
          Sajid Patel Apprentice

              Hopefully, you might have figured it out by now. Adding the solution that worked for me for anyone who might land here, looking for a solution to control the log verbosity of EMS.

           

              The configuration of logging using logback requires a logback.xml file be placed in the classpath of the application. An example is presented below. Here the

           

          <configuration>

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

                  <encoder>

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

                  </encoder>

              </appender>

              <appender name="LOGS" class="ch.qos.logback.core.FileAppender">

                  <file>myLogFile.log</file>

                  <append>false</append>

                  <encoder>

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

                  </encoder>

              </appender>


              <!--Set both if the levels below to TRACE to see the details of your communication with the server.-->

              <logger name="com.thingworx" level="ERROR"/> <!-- This will only print error logs bringing down the verbosity -->

           

              <root level="INFO"> <!-- setting level to OFF will completely disable logging -->

                  <appender-ref ref="STDOUT"/>

                  <appender-ref ref="LOGS"/>

              </root>

          </configuration>

           


          For more information, visit http://logback.qos.ch/ (logback) or http://www.slf4j.org/ (SLF4J). Also, a sample file, called logback-template.xml, is provided in the /samples/resources sub-directory of the Java SDK installation.