Architecting, installing and maintaining your SAS environment

Roll over SAS Studio logs based on size

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Roll over SAS Studio logs based on size

Hi Members,

 

I wanted to check if we can update any config file so that the SAS Studio mid tier logs are rolled over based on the file size. The log grows at a tremendous pace and would like to ensure that we keep an eye on its size. It is present under

<sas config>/Lev1/Web/Logs/SASServer2*/SASStudioMidTier.log

 

Thanks in advance,

SK


Accepted Solutions
Solution
‎11-17-2017 10:25 AM
Trusted Advisor
Posts: 1,436

Re: Roll over SAS Studio logs based on size

[ Edited ]
Posted in reply to shirishkamath

I believe there is no documentation about it in documentation.sas.com ( http://documentation.sas.com/?docsetId=logug&docsetTarget=p0vt6dps7nzkbgn0zntzi3qs3a0d.htm&docsetVer... ), however this system is based on a broadly commonly used Log4J and Apache.

 

https://wiki.apache.org/logging-log4j/Log4jXmlFormat

 

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  <appender name="stdout" class="org.apache.log4j.ConsoleAppender"> 
    <layout class="org.apache.log4j.PatternLayout"> 
      <!-- Pattern to output the caller's file name and line number -->
      <param name="ConversionPattern" value="%5p [%t] (%F:%L) - %m%n"/> 
    </layout> 
  </appender> 
  <appender name="R" class="org.apache.log4j.RollingFileAppender"> 
    <param name="file" value="example.log"/>
    <param name="MaxFileSize" value="100KB"/>
    <!-- Keep one backup file -->
    <param name="MaxBackupIndex" value="1"/>
    <layout class="org.apache.log4j.PatternLayout"> 
      <param name="ConversionPattern" value="%p %t %c - %m%n"/> 
    </layout> 
  </appender> 
  <root> 
    <priority value ="debug" /> 
    <appender-ref ref="stdout" /> 
    <appender-ref ref="R" /> 
  </root>
</log4j:configuration>

 

 

View solution in original post


All Replies
Super User
Posts: 8,080

Re: Roll over SAS Studio logs based on size

Posted in reply to shirishkamath

Look at the logconfig.xml of your workspace server.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Trusted Advisor
Posts: 1,436

Re: Roll over SAS Studio logs based on size

Posted in reply to shirishkamath

Hello @shirishkamath,

 

not the workspace server logs, but "sas/config/Lev1/Web/Common/LogConfig/SASStudio-log4j.xml"

 

You are looking for to un-comment the rolling appended functions

 

  <!-- A time/date based rolling appender
    <appender class="org.apache.log4j.DailyRollingFileAppender" name="SAS_FILE">
        <param name="datePattern" value="'.'yyyy-MM-dd"/>
        <param name="append" value="true"/>
        <param name="file" value="${config.lev.web.appserver.logs.dir}/SASStudioMidTier3.4.log"/>
        <layout class="com.sas.svcs.logging.CustomPatternLayout">
            <param name="ConversionPattern" value="%d [%t] %-5p [%u] %c - %m%n"/>
        </layout>
    </appender>
    -->

 

Occasional Contributor
Posts: 7

Re: Roll over SAS Studio logs based on size

Posted in reply to JuanS_OCS
Thanks Juan. This helps. But can you also let me know what changes do I need to make in order to roll over the logs based on size? Looks like this piece will roll over the log based on time stamp?
Solution
‎11-17-2017 10:25 AM
Trusted Advisor
Posts: 1,436

Re: Roll over SAS Studio logs based on size

[ Edited ]
Posted in reply to shirishkamath

I believe there is no documentation about it in documentation.sas.com ( http://documentation.sas.com/?docsetId=logug&docsetTarget=p0vt6dps7nzkbgn0zntzi3qs3a0d.htm&docsetVer... ), however this system is based on a broadly commonly used Log4J and Apache.

 

https://wiki.apache.org/logging-log4j/Log4jXmlFormat

 

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  <appender name="stdout" class="org.apache.log4j.ConsoleAppender"> 
    <layout class="org.apache.log4j.PatternLayout"> 
      <!-- Pattern to output the caller's file name and line number -->
      <param name="ConversionPattern" value="%5p [%t] (%F:%L) - %m%n"/> 
    </layout> 
  </appender> 
  <appender name="R" class="org.apache.log4j.RollingFileAppender"> 
    <param name="file" value="example.log"/>
    <param name="MaxFileSize" value="100KB"/>
    <!-- Keep one backup file -->
    <param name="MaxBackupIndex" value="1"/>
    <layout class="org.apache.log4j.PatternLayout"> 
      <param name="ConversionPattern" value="%p %t %c - %m%n"/> 
    </layout> 
  </appender> 
  <root> 
    <priority value ="debug" /> 
    <appender-ref ref="stdout" /> 
    <appender-ref ref="R" /> 
  </root>
</log4j:configuration>

 

 

Occasional Contributor
Posts: 7

Re: Roll over SAS Studio logs based on size

Posted in reply to JuanS_OCS
Awesome, thanks Juan Smiley Happy I really appreciate your help.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 174 views
  • 9 likes
  • 3 in conversation