- Use sl4fj as a backend to org.libresonic.Logger - Output the same logs to libresonic.log as the console - Use spring-boot logging constructs - Turn down logging to error for non-libresonic classes info for libresonic classes and liquibase (perhaps change this in the future, but might be helpful for folks migrating their databases). Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>master
							parent
							
								
									a12bdd6e0a
								
							
						
					
					
						commit
						07ff71df0c
					
				| @ -0,0 +1,30 @@ | |||||||
|  | package org.libresonic.player.spring; | ||||||
|  | 
 | ||||||
|  | import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; | ||||||
|  | import org.springframework.boot.logging.LogFile; | ||||||
|  | import org.springframework.boot.logging.LoggingApplicationListener; | ||||||
|  | import org.springframework.context.ApplicationListener; | ||||||
|  | import org.springframework.core.Ordered; | ||||||
|  | import org.springframework.core.env.MapPropertySource; | ||||||
|  | import org.springframework.core.env.PropertySource; | ||||||
|  | 
 | ||||||
|  | import java.util.Collections; | ||||||
|  | 
 | ||||||
|  | import static org.libresonic.player.service.SettingsService.getLogFile; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public class LoggingFileOverrideListener implements ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered { | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { | ||||||
|  |         PropertySource ps = new MapPropertySource("LogFileLocationPS", | ||||||
|  |                 Collections.singletonMap(LogFile.FILE_PROPERTY, getLogFile().getAbsolutePath())); | ||||||
|  |         event.getEnvironment().getPropertySources().addLast(ps); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public int getOrder() { | ||||||
|  |         return LoggingApplicationListener.DEFAULT_ORDER - 1; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1 @@ | |||||||
|  | org.springframework.context.ApplicationListener=org.libresonic.player.spring.LoggingFileOverrideListener | ||||||
| @ -1,4 +1,8 @@ | |||||||
| spring.mvc.view.prefix: /WEB-INF/jsp/ | spring.mvc.view.prefix: /WEB-INF/jsp/ | ||||||
| spring.mvc.view.suffix: .jsp | spring.mvc.view.suffix: .jsp | ||||||
| server.error.includeStacktrace: ALWAYS | server.error.includeStacktrace: ALWAYS | ||||||
| logging.level.org.springframework.web=INFO | logging.level.root=WARN | ||||||
|  | logging.level.org.libresonic=INFO | ||||||
|  | logging.level.liquibase=INFO | ||||||
|  | logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p){green} %clr(---){faint} %clr(%-40.40logger{32}){blue} %clr(:){faint} %m%n%wEx | ||||||
|  | logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss.SSS} %5p --- %-40.40logger{32} : %m%n%wEx | ||||||
|  | |||||||
| @ -1,8 +1,8 @@ | |||||||
| ${AnsiColor.BRIGHT_BLUE}  _      _ _              ${AnsiColor.BRIGHT_BLACK}                 _       ______ | ${AnsiColor.BLUE}  _      _ _              ${AnsiColor.BRIGHT_BLACK}                 _       ______ | ||||||
| ${AnsiColor.BRIGHT_BLUE} | |    (_) |             ${AnsiColor.BRIGHT_BLACK}                (_)      \ \ \ \ | ${AnsiColor.BLUE} | |    (_) |             ${AnsiColor.BRIGHT_BLACK}                (_)      \ \ \ \ | ||||||
| ${AnsiColor.BRIGHT_BLUE} | |     _| |__  _ __ ___ ${AnsiColor.BRIGHT_BLACK} ___  ___  _ __  _  ___   | | | | | ${AnsiColor.BLUE} | |     _| |__  _ __ ___ ${AnsiColor.BRIGHT_BLACK} ___  ___  _ __  _  ___   | | | | | ||||||
| ${AnsiColor.BRIGHT_BLUE} | |    | | '_ \| '__/ _ \${AnsiColor.BRIGHT_BLACK}/ __|/ _ \| '_ \| |/ __|  | | | | | ${AnsiColor.BLUE} | |    | | '_ \| '__/ _ \${AnsiColor.BRIGHT_BLACK}/ __|/ _ \| '_ \| |/ __|  | | | | | ||||||
| ${AnsiColor.BRIGHT_BLUE} | |____| | |_) | | |  __/${AnsiColor.BRIGHT_BLACK}\__ \ (_) | | | | | (__   | | | | | ${AnsiColor.BLUE} | |____| | |_) | | |  __/${AnsiColor.BRIGHT_BLACK}\__ \ (_) | | | | | (__   | | | | | ||||||
| ${AnsiColor.BRIGHT_BLUE} |______|_|_.__/|_|  \___|${AnsiColor.BRIGHT_BLACK}|___/\___/|_| |_|_|\___|  | | | | | ${AnsiColor.BLUE} |______|_|_.__/|_|  \___|${AnsiColor.BRIGHT_BLACK}|___/\___/|_| |_|_|\___|  | | | | | ||||||
| ${AnsiColor.BRIGHT_BLUE}                          ${AnsiColor.BRIGHT_BLACK}                         /_/_/_/ | ${AnsiColor.BLUE}                          ${AnsiColor.BRIGHT_BLACK}                         /_/_/_/ | ||||||
| ${AnsiColor.BRIGHT_BLUE}                          ${AnsiColor.BRIGHT_BLACK}      ${application.version} | ${AnsiColor.BLUE}                          ${AnsiColor.BRIGHT_BLACK}      ${application.version} | ||||||
|  | |||||||
					Loading…
					
					
				
		Reference in new issue