SourceHorizon / logger

Small, easy to use and extensible logger which prints beautiful logs.
https://pub.dev/packages/logger
MIT License
197 stars 33 forks source link

Logger not working inside a Docker process #73

Closed 9clg6 closed 4 months ago

9clg6 commented 4 months ago

Hello,

I'm developing a Bot Discord to backup servers. I use Logger for two things: classic display and log management via LogOutput. Everything works perfectly locally: in the console and in my files.

But when I put all this in a docker image, I get absolutely NO log, either in the console or in the files.

This is my LoggerService :

https://github.com/9clg6/discord_backup_bot/blob/master/bin/utils/logger.util.dart

And my LogOutpout

https://github.com/9clg6/discord_backup_bot/blob/master/bin/service/logger.service.dart

Bungeefan commented 4 months ago

Hi, how are you running your bot? Locally and in the docker image.

The Reason I am asking is, I noticed you didn't set a filter on the logger instance and therefore, the default filter (DevelopmentFilter) is set, which doesn't log when asserts are disabled (aka. release mode in Flutter).

9clg6 commented 4 months ago

Hello, Locally via VSCode with launch.json :

{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Dart", "type": "dart", "request": "launch", "program": "bin/main.dart" }, ] }

and in Docker via DOCKERFILE :

https://github.com/9clg6/discord_backup_bot/blob/master/Dockerfile

with command sudo docker build -t dibo . && sudo docker run dibo

Bungeefan commented 4 months ago

I see, AFAIK, VS-Code launches per default in debug mode (aka with-asserts). Have you tried either enabling them in the Dockerfile or using the ProductionFilter?

9clg6 commented 4 months ago

Yes ProductionFilter worked, thanks :)