spring boot logging using log4j to external file with shared, external log4j configuration -
i have spring boot application. pulls log4j.properties external location in file system; specify file's location in application.yml file:
... logging: config: ${log_config_location}/log4j.properties ...
since log4j.properties file shared other applications, in it, cannot use
... log4j.appender.fileappender.file=log_file_name.log ...
because ... applications log same file (probably wouldn't work b/c of io)
what want do, leverage application's name specified in application.yml file:
... spring: application: name: my_foo_application ...
and set log file name , location to
${log_files_location}/services/${spring.application.name}/${spring.application.name}.log
i tried inside application.yml file:
spring: application: name: my_foo_application logging: config: ${log_config_location}/log4j.properties file: ${log_files_location}/services/${spring.application.name}/${spring.application.name}.log
this had no effect - not see log file in location i'm expecting.
i commented out 'logging.file....' in application.yml & added log4j.properties file:
log4j.appender.fileappender.file=${log_files_location}/services/${spring.application.name}/${spring.application.name}.log
it (not surprisingly) had no effect
how can accomplished?
try adding following line.
log4j.appender.fileappener=org.apache.log4j.rollingfileappender
Comments
Post a Comment