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

improve logging #235

Closed
pan64 opened this issue May 28, 2021 · 3 comments · Fixed by #287
Closed

improve logging #235

pan64 opened this issue May 28, 2021 · 3 comments · Fixed by #287
Assignees
Labels
good first issue Help Wanted We will be glad if somebody proposes a solution via PR Task

Comments

@pan64
Copy link

pan64 commented May 28, 2021

At first you need to use getLogger("string") instead of direct usage of logging.debug.
In general would be nice to have more debug and some info messages logged.

@allburov allburov added Task good first issue Help Wanted We will be glad if somebody proposes a solution via PR labels May 28, 2021
@tanvimoharir
Copy link

Hello ,I would like to work on this.
Thanks

@karanpreetsingh1990
Copy link

I've come across some issues with the loggers as well because it's using the logging.debug statement directly.

I have a custom field being added to my log and using this module raises an error for the value not being present.

extra = {'hostname': socket.gethostname()}
try:
    if os.path.exists("./logging_config.ini"):
        fileConfig('logging_config.ini', disable_existing_loggers=True)
    logger = logging.getLogger()
    logger = logging.LoggerAdapter(logger, extra)
except Exception as e:
    print("Couldn't find ini file")
    print(e)
    sys.exit(1)

The error I get is the following:

--- Logging error ---
Traceback (most recent call last):
  File "logging/__init__.py", line 434, in format
  File "logging/__init__.py", line 430, in _format
KeyError: 'hostname'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "logging/__init__.py", line 1083, in emit
  File "logging/__init__.py", line 927, in format
  File "logging/__init__.py", line 666, in format
  File "logging/__init__.py", line 635, in formatMessage
  File "logging/__init__.py", line 436, in format
ValueError: Formatting field not found in record: 'hostname'

It would be great if the module could use the existing logger.

@beliaev-maksim beliaev-maksim self-assigned this Sep 8, 2021
beliaev-maksim added a commit to beliaev-maksim/artifactory that referenced this issue Sep 8, 2021
@beliaev-maksim beliaev-maksim linked a pull request Sep 8, 2021 that will close this issue
beliaev-maksim added a commit to beliaev-maksim/artifactory that referenced this issue Sep 8, 2021
beliaev-maksim added a commit to beliaev-maksim/artifactory that referenced this issue Sep 13, 2021
@beliaev-maksim
Copy link
Member

now is added to develop branch

will be added in next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Help Wanted We will be glad if somebody proposes a solution via PR Task
Development

Successfully merging a pull request may close this issue.

5 participants