[AWS] How to check logs

Introduction

An error related to Unicorn occurred during automatic deployment during portfolio creation. Regarding the content of the error, it was a simple content that the location of the file was wrong, but I neglected to check the log (Rather, I didn't understand how to check the log), it took time to resolve, so I would like to describe it including the command.

environment

Ruby on Rails '6.0.0' Ruby '2.6.5'

error contents

Until now, automatic deployment by Capistrano was possible. After editing the application locally, as usual When I executed the deploy command like this, the following error appeared.

01:12 unicorn:start
(abridgement)
SSHKit::Command::Failed: bundle exit status: 1
bundle stdout: Nothing written
bundle stderr: master failed to start, check stderr log for details
(abridgement)

Toward a solution

If you refer to the error statement, there is a description of ** check stderr log for details **, so check the log. I tried to do it, but I started by wondering how to check it, so I will describe it.

#Move to application directory
[ec2-user@ip-172-31-23-189~]$ cd /var/www/Application name

#Move to current directory
[ec2-user@ip-172-31-23-189 <Repository name>]$ cd current

#Go to log directory
[ec2-user@ip-172-31-23-189 current]$ cd log

#Display information of files contained in log
[ec2-user@ip-172-31-23-189 log]$ ls
production.log  unicorn.stderr.log  unicorn.stdout.log
tail -f unicorn.stderr.log
          or
cat unicorn.stderr.log

tail -f: Display 10 lines of the latest log cat: Show all logs

This time, I first tried using "tail -f", but I don't know the cause. Therefore, I used the "cat" command to display all the logs. Then

(abridgement)
bundler: failed to load command: unicorn (/var/www/myapp/shared/bundle/ruby/2.6.0/bin/unicorn)
Zeitwerk::NameError: expected file /var/www/myapp/releases/20201226010858/app/controllers/users/users_controller.rb to define constant Users::UsersController, but didn't

I found the above error log! !! For the time being, I understand that there is a problem with uses_controller.rb. So I came up with a solution.

in conclusion

I realized again the importance of checking the logs. Even if you just copy and paste the error sentence and search Through this error, I realized that it could not be resolved. .. .. .. I will continue to study! !! !! !!

Recommended Posts

[AWS] How to check logs
How to check the logs in the Docker container
How to check JSF version
How to check Java installed on Mac
How to deploy
How to send push notifications on AWS
How to deploy a container on AWS Lambda
How to use Java framework with AWS Lambda! ??
How to save images on Heroku to S3 on AWS
How to make duplicate check logic more readable
How to check Rails commands in the terminal
How to develop OpenSPIFe
How to call AmazonSQSAsync
How to use Map
How to write Rails
How to use rbenv
How to use letter_opener_web
How to use with_option
How to use fields_for
How to use java.util.logging
How to use map
How to use collection_select
How to adapt Bootstrap
How to use Twitter4J
How to use active_hash! !!
How to install Docker
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
How to write dockerfile
How to uninstall Rails
How to install docker-machine
[How to use label]
How to make shaded-jar
How to write docker-compose
How to use identity
How to use hashes
How to write Mockito
How to create docker-compose
How to use JUnit 5
How to install MySQL
How to write migrationfile
How to build android-midi-lib
How to use Dozer.mapper
How to use Gradle
How to use org.immutables
How to use java.util.stream.Collector
How to use VisualVM
How to use Map
How to install ngrok
How to type backslash \
How to concatenate strings
How to install Ruby on an EC2 instance on AWS
How to deploy Java to AWS Lambda with Serverless Framework
List how to learn from Docker to AKS on AWS
How to check only one RadioButton check by default (Note)
How to download images from AWS S3 (rails, carrierwave)
How to check CircleCI code and automatically deploy to Heroku
[Linux] Easy commentary! How to check and change permissions
How to delete BOM (UTF-8)
How to correctly check the local HTML file in the browser