Skip to main content
1-Visitor
May 12, 2016
Question

Disabling of log file in EMS

  • May 12, 2016
  • 2 replies
  • 2754 views

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

2 replies

5-Regular Member
May 12, 2016

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.

pnali1-VisitorAuthor
1-Visitor
May 12, 2016

thanks ravi,can you please guide me where can I get the config.json file.

5-Regular Member
May 13, 2016

Just to clarify, when you referred this to as SDK EMS, are you referring to one of the SDKs (C, Java, dotnet etc) or the EMS (Edge MicroServer)?

12-Amethyst
July 13, 2016

    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.