error lvl not logged in deluge 2

Suggest, post, or discuss plugins for Deluge
basher
Leecher
Leecher
Posts: 91
Joined: Wed Sep 29, 2021 8:42 am
Location: Estonia/Spain

error lvl not logged in deluge 2

Post by basher »

Updated all 1.3 plugins I'm using to support deluge 2.0.5, including the required logging change

Code: Select all

import logging
log = logging.getLogger(__name__)
but noticed log.error() level is not being logged by default, ie nothing is logged to deluge.log at all. Is this expected? Error level used to be logged by default under v1.3. Smells like a possible bug to me - don't see why error level should never be logged.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: error lvl not logged in deluge 2

Post by mhertz »

Tedius work that :) (updating plugins, I mean), espicially ones with GTK-UI support and not just core-plugins.

Anyway, I couldn't really reproduce here, unless i'm misunderstanding:

Code: Select all

20:44:57 [DEBUG   ][deluge_logtest.core             :23  ] debug
20:44:57 [INFO    ][deluge_logtest.core             :24  ] info
20:44:57 [WARNING ][deluge_logtest.core             :25  ] warning
20:44:57 [ERROR   ][deluge_logtest.core             :26  ] error
Initially I just imported deluge.logging and defined that "getlogger" thing in my local python interpretter, and ran a few debug functions, and there saw that no output posted for the various levels except warning and error, so not for debug and info, but when actually running through a little stupid deluge plugin I made for tesing this, then as per above seemingly worked fine and dandy them all.

If I misunderstood your post, then I do apologize in advance.
basher
Leecher
Leecher
Posts: 91
Joined: Wed Sep 29, 2021 8:42 am
Location: Estonia/Spain

Re: error lvl not logged in deluge 2

Post by basher »

Nope, you understood perfectly. Then it's odd what's going on here. My plugin is logging line such as

Code: Select all

log.error("test err")
but ~/.config/deluge/deluge.log remains empty. Only when deluge fails to start is when something is written to that file, eg

Code: Select all

Cannot start deluged, listen port in use.                                                                                                                                                                                                                                                                                 
Check for other running daemons or services using this port: :22756
Note deluge is running in its default log level, whatever that is.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: error lvl not logged in deluge 2

Post by mhertz »

Hmm, that is indeed strange.

I tested btw through starting deluged from terminal with debug-logging enabled, and not from e.g. systemd. I've seen some systemd deluged service-files setup with warning log-level enabled by default, saved in profile-dir(though warning still logs error level, so not that, but regardless).Anyway, instead of messing with systemd for this, then I just did what that does, and ran deluged with forking disabled(-d) and added a warning debug-level, and still worked(didn't see why shouldn't, but just when not having other ideas).

Last seemed to vagually remember something about maybe only log written at deamon shutdown, or parts of, at times, but neither could reproduce that.

Let me know if can help troubleshoot this further somehow.
basher
Leecher
Leecher
Posts: 91
Joined: Wed Sep 29, 2021 8:42 am
Location: Estonia/Spain

Re: error lvl not logged in deluge 2

Post by basher »

> debug-logging enabled

That's probably why you're seeing it. I'm not explicitly setting any logging levels when starting deluge. And this is how I was running it during the v1.3 days as well - it kept the logfile quiet, but errors still were logged. Don't really see a case where I wouldn't want to be notified of errors.

Looks like it's changed with version 2 and am curious whether that's an inadvertent regression, or a conscious change that was made by the dev team.

Process tree showing the deluge processes (note it says 2.0.3, but it's really 2.0.5); this demonstrates no other option is passed in besides the port:

Code: Select all

$ ps -ef | grep deluge | grep -v grep
basher   224636      1 13 Jan13 ?        1-09:45:01 /opt/deluge-2.0.3/bin/python3 /home/basher/bin/deluged -p 22756
basher   224638      1  0 Jan13 ?        00:48:14 deluge-web
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: error lvl not logged in deluge 2

Post by mhertz »

As far as I know(which admittedly isn't much, but still), and checked quickly the code for both, then by default logs error's upon stdout(filename is none for both by default). So you're right we don't specifically have to set level, as a default given('error' - and which coincidentally explains why not getting output for any "lower" log-levels in my first tests in local python interpretter, importing/using deluge.logging), but we do have define file if wanting logged to file.

I cannot answer your question unfortunetly, and much puzzled about your grepping above, while getting at all anything logged there(like your former post mentioning).

Puzzling.
DjLegolas
Member
Member
Posts: 35
Joined: Thu Oct 12, 2017 3:31 pm

Re: error lvl not logged in deluge 2

Post by DjLegolas »

So I tried the different log levels, so I used the --loglevel argument (and even without it), and added the following code:

Code: Select all

log.debug('debug')
log.info('info')
log.warning('warning')
log.error('error')
Results:
  • debug:

    Code: Select all

    01:21:32.444 [DEBUG   ][deluge.ui.gtk3.mainwindow         :64  ] debug
    01:21:32.444 [INFO    ][deluge.ui.gtk3.mainwindow         :68  ] info
    01:21:32.444 [WARNING ][deluge.ui.gtk3.mainwindow         :72  ] warning
    01:21:32.444 [ERROR   ][deluge.ui.gtk3.mainwindow         :78  ] error
    
  • info:

    Code: Select all

    01:21:54.531 [INFO    ][deluge.ui.gtk3.mainwindow         :68  ] info
    01:21:54.531 [WARNING ][deluge.ui.gtk3.mainwindow         :72  ] warning
    01:21:54.531 [ERROR   ][deluge.ui.gtk3.mainwindow         :78  ] error
    
  • warning:

    Code: Select all

    01:22:18.242 [WARNING ][deluge.ui.gtk3.mainwindow         :72  ] warning
    01:22:18.242 [ERROR   ][deluge.ui.gtk3.mainwindow         :78  ] error
    
  • error:

    Code: Select all

    01:22:49.984 [ERROR   ][deluge.ui.gtk3.mainwindow         :78  ] error
    
  • argument not used:

    Code: Select all

    01:23:15.818 [ERROR   ][deluge.ui.gtk3.mainwindow         :78  ] error
    
basher
Leecher
Leecher
Posts: 91
Joined: Wed Sep 29, 2021 8:42 am
Location: Estonia/Spain

Re: error lvl not logged in deluge 2

Post by basher »

That's how it should be, but isn't the case for me. Can you confirm the deluge version you're running?
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: error lvl not logged in deluge 2

Post by mhertz »

Just to make completely sure, rulling other stuff out, then e.g. run 'fuser <PathTo/deluged.log>' and 'ps <ObtainedPidFromPreviousCommand>', to see path of process accessing said logfile and the command that process is run with specifically.

Code: Select all

martin@arch ~ % deluged -L debug -l deluge.log
martin@arch ~ % fuser deluge.log 
/home/martin/deluge.log:   717
martin@arch ~ % ps 717
    PID TTY      STAT   TIME COMMAND
    717 ?        Sl     0:01 /usr/bin/python /usr/bin/deluged -L debug -l deluge.log
DjLegolas
Member
Member
Posts: 35
Joined: Thu Oct 12, 2017 3:31 pm

Re: error lvl not logged in deluge 2

Post by DjLegolas »

I'm using the latest version in github (the develop branch)...
Post Reply