Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Logback config is stored in the application.properties file, along with other springboot properties
- The syntax is very simple but your control is very limited
- server.port=5000
- # Database connection
- spring.datasource.url=${TREECREATE_JDBC_URL}
- spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
- # Session
- spring.session.store-type=jdbc
- spring.session.jdbc.initialize-schema=always
- # How long does a session last without activity, in seconds
- spring.session.timeout=900
- # Logging with a roll over every day
- logging.file.name=logs/treecreate.log
- logging.pattern.rolling-file-name=logs/treecreate-%d{yyyy-MM-dd}.%i.log.gz
- logging.file.max-size=100MB
- logging.file.total-size-cap=2GB
- logging.file.max-history=60
- LOG4j2 config in a log4j2.properties file
- Offers far more control but is a bit harder to configure
- # basic properties
- name=LoggerProperties
- property.filename = logs
- appenders = console, discord, rolling
- # Console output
- appender.console.type = Console
- appender.console.name = Console
- appender.console.layout.type = PatternLayout
- appender.console.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
- # Rolling File output. Rollover occurs on every 7th day ()
- appender.rolling.type = RollingFile
- appender.rolling.name = RollingFile
- appender.rolling.fileName = ${filename}/program.log
- appender.rolling.filePattern = ${filename}/%d{yyyy-MM-dd}.log.gz
- appender.rolling.layout.type = PatternLayout
- appender.rolling.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
- appender.rolling.policies.type = Policies
- appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
- appender.rolling.policies.time.interval = 7
- appender.rolling.policies.time.modulate = true
- appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
- appender.rolling.policies.size.size=5MB
- appender.rolling.strategy.type = DefaultRolloverStrategy
- appender.rolling.strategy.max = 5
- # Discord error logging
- appender.discord = dev.hotdeals.bob_the_discord_bot.Service.DiscordAppender
- appender.discord.name = DiscordAppender
- appender.discord.type = DiscordAppender
- logger.rolling.name = dev.hotdeals.bob_the_discord_bot
- logger.rolling.level = debug
- logger.rolling.additivity = true
- logger.rolling.appenderRef.rolling.ref = RollingFile
- rootLogger.level = debug
- rootLogger.appenderRefs = console, discord
- rootLogger.appenderRef.stdout.ref = Console
- rootLogger.appenderRef.discord.ref = DiscordAppender
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement