Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Corrected links that should have been relative instead of absolute.

By default, Adeptia Connect stores and displays the log messages in standard format. However, it also gives you the flexibility to log and display the messages in popular format like JSON. To set this your preference for output in JSON format, you need to follow the steps below:

  1. Go to …<ConnectServerInstallFolder>\AdeptiaServer\ServerKernel\etc location.
  2. Open log4J-2.xml file.
  3. Comment out the code as shown below:

    Code Block
    themeMidnight
     <!--  <Console name="console" target="SYSTEM_OUT">
                <PatternLayout pattern="${sys:log4j.appender.console.layout.ConversionPattern}"/>
           </Console>-->


  4. Insert the code given below inside the <Appenders>...</Appenders> tags in the file:

    Code Block
    themeMidnight
    <RollingFile name="console" fileName="${sys:abpm.kernelout.file.location}/${sys:log4j.appender.file.File}"
               filePattern ="${sys:abpm.kernelout.file.location}/${custom:log4j.appender.file.File}-%d{yyyy-MM-dd}-%i.log">
                <JSONLayout compact="true" eventEol="true"/>
                <Policies>
                <SizeBasedTriggeringPolicy size="${sys:log4j.appender.retry.file.MaxFileSize}" />
                </Policies>
                <DefaultRolloverStrategy max="${sys:log4j.appender.retry.file.MaxBackupIndex}"/>
           </RollingFile>


  5. Save the file.

Setting this preference creates two new files 'KernelSystem.log' and 'WebrunnerSystem.log' which contain the logs in JSON format.  These files contain the log messages written by log4j

Please find the attached . I have added the changes which are required for JSON layout.
Below are the changes:

  1. Add a new rolling file appender in the palace of the console appender with the same "console". we need to comment the console marked as yellow and add new rolling marked as green.
 <!--  <Console name="console" target="SYSTEM_OUT">
            <PatternLayout pattern="${sys:log4j.appender.console.layout.ConversionPattern}"/>
       </Console>-->

       <RollingFile name="console" fileName="${sys:abpm.kernelout.file.location}/${sys:log4j.appender.file.File}"
           filePattern ="${sys:abpm.kernelout.file.location}/${custom:log4j.appender.file.File}-%d{yyyy-MM-dd}-%i.log">
            <JSONLayout compact="true" eventEol="true"/>
            <Policies>
            <SizeBasedTriggeringPolicy size="${sys:log4j.appender.retry.file.MaxFileSize}" />
            </Policies>
            <DefaultRolloverStrategy max="${sys:log4j.appender.retry.file.MaxBackupIndex}"/>
       </RollingFile>
  1. We need to add this new rolling file appender because for logs we need to create a new file. We can not use the existing one because  "webrunner.log" and kernel log files we are writing are System.out and System.error (Standard error and output) which are not in JSon form. 
  2. We will create 2 different files KernelSystem.log and WebrunnerSystem.log in which we will write the logs in the form of JSON.
  3. After this change you will see the logs like below:

2.

Info
You can use the JSON layout parameters in log4J-2.xml file based on your requirements. Click here to know more about the parameters. 



Panel
borderStylesolid
titleYou may be interested in...
What's new
Best practices
Training guides
Frequently asked questions
Adeptia Connect APIs
Adeptia security report
Panel
borderStylesolid
titleRelated links
Logging