Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review logging #178

Open
justinlittman opened this issue Apr 8, 2020 · 3 comments · May be fixed by #597
Open

Review logging #178

justinlittman opened this issue Apr 8, 2020 · 3 comments · May be fixed by #597

Comments

@justinlittman
Copy link
Contributor

justinlittman commented Apr 8, 2020

We're producing huge amounts of logs. This should be reviewed to verify that we are not logging unnecessarily verbosely.

Also, it would be good to update the DevOpsDocs to reflect where logs are going: https://github.com/sul-dlss/DevOpsDocs/blob/master/projects/sdr-api/operations-concerns.md#how-do-i-check-the-logs

Added by Peter (9/5/2023): We believe the correct solution is to use the standard Rails logger instead of STDOUT. The task is to find places that do a puts or use STDOUT and instead use the Rails logger like we do in other apps.

@edsu
Copy link
Contributor

edsu commented Aug 2, 2023

It looks like we're not producing any logging at the moment in qa/stage/prod environments. I sprinkled in some log messages into the resources controller and couldn't seem to find them in /opt/app/sdr/sdr-api/current or the Apache logs in /var/log/apache2/. I'm used to seeing a production.log in our app log directory which is symlinked into opt/app/sdr/{app-name}/shared/log.

Some attempt was made in #22 to log to STDOUT per 12 Factor App but maybe we never double checked that logs actually go somewhere useful? I wonder if we should consider aligning sdr-api's logging with what we are doing in other Apache/Rails apps?

edsu added a commit that referenced this issue Aug 2, 2023
Get app log messages going to `production.log` without chattiness of
logging every http request since sdr-api is on the www.

Fixes #178
@edsu edsu linked a pull request Aug 2, 2023 that will close this issue
@edsu
Copy link
Contributor

edsu commented Aug 3, 2023

I'm not sure what I'm doing wrong in #597 but configuring lograge doesn't seem to prevent messages like this from popping up in log/production.log:

I, [2023-08-03T13:43:57.380627 #3845285] INFO -- : [5461a254-b5fb-44f0-a9ea-9fc1a0d3815a] method=POST path=/v1/auth/login format=/ controller=AuthenticationController action=login status=200 allocations=11340 duration=242.22 view=0.70 db=9.24
I, [2023-08-03T13:43:57.572992 #3845285] INFO -- : [0c60c512-1250-4f3a-a53a-257e31508e76] method=GET path=/v1/resources/druid:zs200kj4169 format=/ controller=ResourcesController action=show status=200 allocations=109320 duration=161.05 view=3.02 db=0.25
I, [2023-08-03T13:44:19.845152 #3845285] INFO -- : [f0e6f9c8-7d79-457e-b8dd-6812d4851f21] method=POST path=/v1/auth/login format=/ controller=AuthenticationController action=login status=200 allocations=389 duration=206.39 view=0.22 db=0.30
I, [2023-08-03T13:44:19.939839 #3845285] INFO -- : [5ddadf99-730f-42cc-bae4-556b2d12a304] method=GET path=/v1/resources/druid:zs200kj4169 format=/ controller=ResourcesController action=show status=200 allocations=49196 duration=84.10 view=3.02 db=0.27

It looks like the lograge configuration is getting set up correctly?

sdr@sdr-api-stage:~/sdr-api/current$ bin/rails c -e p
3.2.0 :001 > Rails.configuration.lograge
 => {:enabled=>true, :base_controller_class=>"ActionController::API"}

@ndushay
Copy link
Contributor

ndushay commented Sep 5, 2023

@peetucket will clarify what needs to be done for this ticket, per dev planning mtg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants