0
votes

In production server we are facing a issues like console.log file inside logs folder is not purging automatically. It is growing more than a GB. so server space utilization is reaching 100%.

  1. How to set maximum file size for console.log?
  2. How to archive the console.log file?
  3. Do we have any necessity to write the logging tag in server.xml before or after some particular tag? because in my old project i placed 'logging' tag at last and it works fine.

Server.xml file lines related to logging

<logging maxFileSize="10" maxFiles="6" messageFileName="messages.log" logDirectory="/opt/IBM/WebSphere/Liberty/usr/servers/LibertyServer/logs" />
<logging consoleLogLevel="AUDIT"/>

initOptions.js

var wlInitOptions = {
    connectOnStartup : true,
    timeout : 60000,
    logger : {
        enabled: true, 
        level: 'debug', 
        stringify: true, 
        pretty: false,
        tag: {
            level: false, 
            pkg: true
        }, 
        whitelist: [], 
        blacklist: [],
        nativeOptions: {
            capture: true               
        }
    },
    analytics : {
        enabled: false
    }

};

Currently i can see all the logs in console.log file. I knew it is because of log level is set as AUDIT. To make a note we were using logger.send from device often to send the logs to server.

Worklight version 6.0.0.2 Liberty profile version 8.5.5.0-20130510-0831

if you need any info please comment.

1

1 Answers

0
votes

Please note, maxFiles and maxFileSize does not apply to console.log. Please carefully read:

Liberty profile: Logging and Trace

If you want Liberty log feature to manage log file size and file rollover, you should consider whether you really intend to use console.log or not. I recommend to not use it, in your case.