Search code examples
log4jweblogic

How to make WebLogic create sub-folder under server/logs directory?


We all know that WebLogic server creates logs directory under DOMAIN_HOME/servers/SERVER_NAME directory at server start up. But now I want WebLogic to create my application specific logs directory like below at the server startup.

DOMAIN_HOME/servers/SERVER_NAME/logs/myAppLogs/

Where to do the configuration change for this?

Thank you, Chaitanya


Solution

  • See Change server log file name and location in the Administration Console Online Help.

    EDIT: As per comment, the OP actually wants a file appender to create directories of parent-path if they don't exist. I don't know what versions of weblogic nor log4j are used but according to 9150, old versions of log4j don't implement this behavior:

    We can't assume log4j will have directory creation permissions, only write permissions to the file specified in the configuration. It's up to the server administrator to control the directory tree.

    This should be fixed in version 1.2.12 and later.

    PS: I really prefer to find all logs in the same location on a single machine e.g. /var/log/weblogic/<PROJECTNAME>/myApp-${weblogic.Name}.log. It's really easier to find the last file that changed, to grep log files, etc.