Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
Logback with Elastic Beanstalk

I am having trouble with logging application logs with Elastic Beanstalk. I am running an spring mvc (NOT springboot) WAR file on AWS Elastic Beanstalk on a 'Tomcat 8.5 with Corretto 11 running on 64bit Amazon Linux 2/4.1.3' environment.

Previously I thought the problem was that I was unable to retrieve logs that were written by the application. However, after following suggestion in this question (AWS Elastic Beanstalk Application Logging with Logback) I was able to determine that there was no issue viewing the logs - the actual problem is that the logs are not even written. I ssh to the instance and the log file was not created in the /var/log directory

For reference, here is my logback file appender (full logback.xml in the linked question):

<appender name="APPLOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/var/log/java.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <FileNamePattern>/var/log/java_%d{yyyy-MM-dd}_%i.log</FileNamePattern>
            <!-- keep 14 days' worth of history -->
            <maxHistory>14</maxHistory>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <!-- or whenever the File size reaches 10MB -->
                <maxFileSize>10MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%thread][%X{remoteHost}] %-5level %c{1} - %msg%n</pattern>
            <!-- <pattern>%d %-5p %c{1} - %m%n</pattern> -->
        </encoder>
    </appender>

The app is using slf4j-api-1.7.6, logback-classic-1.2.3 and logback-core-1.2.3. The application logs works as expected when loading the same war on Tomcat server locally.

So now I am wondering (1) Does logback work with Elastic Beanstalk? (2) If yes, does it require something special (permissions?, other dependencies) to write logs to the /var/logs directory?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Based on the comments.

The issue was caused by permissions. By default user applications on EB do not have access to /var/logs.

The solution was to modify the permissions so that the logs can be placed in /var/log/tomcat.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!