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

missing log directory when using -l #537

Open
dutangp opened this issue Mar 7, 2022 · 5 comments
Open

missing log directory when using -l #537

dutangp opened this issue Mar 7, 2022 · 5 comments

Comments

@dutangp
Copy link

dutangp commented Mar 7, 2022

Hello,

Version tested 1.17.0 in docker

Running the application

python3 launcher.py -l /tmp/logs

output error

Traceback (most recent call last):
  File "/usr/lib64/python3.6/logging/config.py", line 565, in configure
    handler = self.configure_handler(handlers[name])
  File "/usr/lib64/python3.6/logging/config.py", line 738, in configure_handler
    result = factory(**kwargs)
  File "/usr/lib64/python3.6/logging/__init__.py", line 1032, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib64/python3.6/logging/__init__.py", line 1061, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/app/logs/server.log'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "launcher.py", line 11, in <module>
    main.main()
  File "src/main.py", line 71, in main
    logging.config.dictConfig(log_config)
  File "/usr/lib64/python3.6/logging/config.py", line 802, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/lib64/python3.6/logging/config.py", line 573, in configure
    '%r: %s' % (name, e))
ValueError: Unable to configure handler 'file': [Errno 2] No such file or directory: '/app/logs/server.log'

I guess there is a missing configuration in the src/main.py to setup server.log file in the directory taken from the arg.

@bugy
Copy link
Owner

bugy commented Mar 8, 2022

Hi @dutangp, yes, you are right. -l flag affects only script logs (not server.log), this is a bug

@bugy bugy added the bug label Mar 8, 2022
@dutangp
Copy link
Author

dutangp commented Mar 8, 2022

hey,

Just a suggestion, in docker at least, to be able to remove this server.log in file as all the log a shipped to stdout of the container and can be handled differently.

@dutangp
Copy link
Author

dutangp commented Mar 17, 2022

hello,

For info I found the way in docker by rebuilding the Dockerfile with ENTRYPOINT instead of CMD

ENTRYPOINT [ "python3", "launcher.py" ]

and modifying the file logging.json as below

{
  "version": 1,
  "disable_existing_loggers": false,
  "formatters": {
    "simple": {
      "format": "%(asctime)s [%(name)s.%(levelname)s] %(message)s"
    }
  },
  "handlers": {
    "console": {
      "class": "logging.StreamHandler",
      "level": "DEBUG",
      "formatter": "simple",
      "stream": "ext://sys.stdout"
    }
  },
  "loggers": {
  },
  "root": {
    "level": "DEBUG",
    "handlers": [
      "console"
    ]
  }
}

In docker server.log doesn't bring anything as logs can be handled via std out only and redirection to ES. As well the entrypoint can handle the parameters -d, -l, -t.

@bugy no rush at all on fixing this point imho but you are the boss :)

@bugy
Copy link
Owner

bugy commented Mar 18, 2022

Hi @dutangp, I would agree with you, that a standard logging mechanism in docker is stdout.
However, someone can also mount script server log folder to a host folder, making them "persistent". It's needed for script execution logs anyway.
For me, the proper fix would be to make it configurable via conf.json. For now I would keep existing behaviour as it is.

@bugy
Copy link
Owner

bugy commented Oct 7, 2022

@dmarteau @dutangp i made a fix for it, could you test it please?

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

No branches or pull requests

2 participants