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

CLI: Reduce logging output in production environments #3370

Closed
sermayoral opened this issue May 4, 2023 · 15 comments
Closed

CLI: Reduce logging output in production environments #3370

sermayoral opened this issue May 4, 2023 · 15 comments
Assignees
Labels
bug Something isn't working released Available in the stable release

Comments

@sermayoral
Copy link

sermayoral commented May 4, 2023

1. What is not working as documented?

photoprism backup CLI thows a new info message in 2023.05 version which appears even when you set the log level to warning

2. How can we reproduce it?

In the CLI, execute the following command:

docker exec photoprism photoprism -l warning backup -i -f

3. What behavior do you expect?

Do not see info errors

4. What could be the cause of your problem?

A new message has been created using a different logger, or using an inappropriate log level

5. Can you provide us with example files for testing, error logs, or screenshots?

An execution without specifying the log level (default is info) returns the following messages, that is right:

docker exec photoprism photoprism  backup -i -f
time="2023-05-04T21:03:31Z" level=info msg="config: plus extension loaded [1.976566ms]"
time="2023-05-04T21:03:31Z" level=warning msg="replacing existing backup"
time="2023-05-04T21:03:31Z" level=info msg="writing backup to /photoprism/storage/backup/mysql/2023-05-04.sql"
time="2023-05-04T21:03:34Z" level=info msg="completed in 3.441416258s"

An execution specifying the log level to warning returns the following messages, that is wrong:

docker exec photoprism photoprism -l warning backup -i -f
time="2023-05-04T21:02:49Z" level=info msg="config: plus extension loaded [2.863629ms]"
time="2023-05-04T21:02:49Z" level=warning msg="replacing existing backup"

As you can see, now it doesn't show any info message except the "config: plus extension loaded" message, which is info and should NOT appear. The last message is correct, because it has warning level.

6. Which software versions do you use?

(a) PhotoPrism ARM64 Build 230504-cbf48798c

(b) MariaDB 10.11

(c) Debian Bullseye 64 bits.

(d) Browser Types: N/A

(e) Ad Blockers; N/A

7. On what kind of device is PhotoPrism installed?

Indifferent

8. Do you use a Reverse Proxy, Firewall, VPN, or CDN?

Indifferent

@sermayoral sermayoral added the bug Something isn't working label May 4, 2023
@lastzero
Copy link
Member

lastzero commented May 5, 2023

Could you also describe your use case so we may propose a workaround or other parameters?

@sermayoral
Copy link
Author

@lastzero yes. I'm using duplicati to do a backup every day of all my system. When the photoprism backup command throws a message, duplicati undestand it as a warning, and i receive a mail that photoprism thows a message that i should review.

IMG_20230505_081929_880

This is working well in 2022.11 version. The first problem was after updating to 20230502 version.

@javilopezalarcon
Copy link

@lastzero yes. I'm using duplicati to do a backup every day of all my system. When the photoprism backup command throws a message, duplicati undestand it as a warning, and i receive a mail that photoprism thows a message that i should review.

IMG_20230505_081929_880

This is working well in 2022.11 version. The first problem was after updating to 20230502 version.

I have exactly the same problem, well described, I also use duplicati

@lastzero lastzero changed the title CLI photoprism backup throws a new info message as warning? CLI: Reduce logging output in production environments May 5, 2023
lastzero added a commit that referenced this issue May 5, 2023
Signed-off-by: Michael Mayer <michael@photoprism.app>
@lastzero
Copy link
Member

lastzero commented May 5, 2023

My changes reduce the logger output to an absolute minimum when you combine -l warning with the --prod flag:

# photoprism -l warning --prod backup -i
ERRO[2023-05-05T07:50:18Z] /photoprism/storage/backup/mysql/2023-05-05.sql already exists 

An updated development preview will be available soon. Happy testing!

@lastzero lastzero added the please-test Ready for acceptance test label May 5, 2023
@lastzero
Copy link
Member

lastzero commented May 5, 2023

The preview image has been updated so you can test if it works for you:

@sermayoral
Copy link
Author

Thank you very much @lastzero. I will check as soon as I arrive home this afternoon 😊

@sermayoral
Copy link
Author

sermayoral commented May 5, 2023

@lastzero is the preview image multi-arch?

docker compose up -d photoprism
[+] Running 0/1
 ⠋ photoprism Pulling                                                                                                       3.1s 
no matching manifest for linux/arm64/v8 in the manifest list entries

SOLVED using photoprism/photoprism:preview-arm64

@lastzero
Copy link
Member

lastzero commented May 5, 2023

It's an old tag, don't use it. I've started a new multi-arch preview build for you.

@lastzero
Copy link
Member

lastzero commented May 5, 2023

Preview and tag updated, so you can test it on ARM64.

@sermayoral
Copy link
Author

The preview-arm64 works:

docker exec photoprism photoprism -l warning backup -i -f
time="2023-05-05T16:22:39Z" level=warning msg="replacing existing backup"

But is and old tag. Testing the new one

@sermayoral
Copy link
Author

@lastzero, working great.

Build 230505-7a7ffbced

Default log level:

docker exec photoprism photoprism backup -i -f
time="2023-05-05T16:32:27Z" level=warning msg="replacing existing backup"
time="2023-05-05T16:32:27Z" level=info msg="writing backup to /photoprism/storage/backup/mysql/2023-05-05.sql"
time="2023-05-05T16:32:29Z" level=info msg="completed in 1.764198639s"

Warning log level:

docker exec photoprism photoprism -l warning backup -i -f
time="2023-05-05T16:31:59Z" level=warning msg="replacing existing backup"

Default log level with --prod

docker exec photoprism photoprism --prod backup -i -f
time="2023-05-05T16:36:48Z" level=warning msg="replacing existing backup"
time="2023-05-05T16:36:48Z" level=info msg="writing backup to /photoprism/storage/backup/mysql/2023-05-05.sql"
time="2023-05-05T16:36:50Z" level=info msg="completed in 1.827114428s"

Warning log level with --prod

docker exec photoprism photoprism -l warning --prod backup -i -f
time="2023-05-05T16:35:12Z" level=warning msg="replacing existing backup"

I see no differences between using --prod or not. But in both cases info errors are no longer displayed when the warning level is specified :-)

@lastzero
Copy link
Member

lastzero commented May 5, 2023

The --prod option can make a difference if, for example, the PHOTOPRISM_DEBUG environment variable is set, which displays debug logs at startup until the log level config option is applied.

@lastzero
Copy link
Member

lastzero commented May 5, 2023

Would it be acceptable for you to use the preview build for the next few days until we have enough other changes so that it's worth tagging a new stable release?

@lastzero lastzero added tested Changes have been tested successfully and removed please-test Ready for acceptance test labels May 5, 2023
@sermayoral
Copy link
Author

sermayoral commented May 5, 2023

@lastzero sure :-).

If I can test something else, just tell me it.

@lastzero
Copy link
Member

lastzero commented May 6, 2023

We've released this as an update for you today:

@lastzero lastzero added released Available in the stable release and removed tested Changes have been tested successfully labels Jun 3, 2023
@lastzero lastzero moved this to Released 🌈 in Roadmap 🚀✨ Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Available in the stable release
Projects
Status: Release 🌈
Development

No branches or pull requests

3 participants