Reputation: 1
We have a spring boot application and in the application.properties we set the log file location to be written to /var/log/onbase.log
But whenever the server is started there is one more log that is written to var/onbaseAPP.log (this log is filling up the memory on the box and the server is getting hung up)
We don't have any were in the code to create a onbaseApp.log not sure how it is getting created
please help. thanks in advance.
Upvotes: 0
Views: 527
Reputation: 4356
if you use Log4j or Log4j2, you’ll need to change your dependencies to include the appropriate starter for the logging implementation you want to use and to exclude Logback.
For Maven builds, you can exclude Logback by excluding the default logging starter transitively resolved by the root starter dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
In Gradle, it’s easiest to place the exclusion under the configurations section:
configurations {
all*.exclude group:'org.springframework.boot',
module:'spring-boot-starter-logging'
}
With the default logging starter excluded, you can now include the starter for the logging implementation you’d rather use. With a Maven build you can add Log4j like this:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j</artifactId>
</dependency>
In a Gradle build you can add Log4j like this:
compile("org.springframework.boot:spring-boot-starter-log4j")
your application.properties like this :
logging.path=/var/log/
logging.file=onbase.log
#logging.level.root=WARN
#logging.level.root.org.springframework.security=DEBUG
Source: Spring Boot in action Craig Walls
Upvotes: 2