cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Translate the entire conversation x

Disabling of log file in EMS

pnali
1-Visitor

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.

5 REPLIES 5
Aanjan
12-Amethyst
(To:pnali)

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.

pnali
1-Visitor
(To:Aanjan)

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

Aanjan
12-Amethyst
(To:pnali)

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)?

pnali
1-Visitor
(To:Aanjan)

Yeah we are referring to java SDK Edge micro server. so, is there any way to override those log files or as you mentioned earlier to change config.json but we want the console window as we have to give some manual entry.

SajidPatel
12-Amethyst
(To:pnali)

    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.

Announcements
Top Tags