log module path argument not working as expected #909

Closed
opened 2026-10-05 04:52:16 +02:00 by adam · 3 comments
Owner

The third argument of the *log module is said to set a relative path where to store logs. It would be relative to one of the following depending on how the module is loaded.
global: ~/.znc/moddata/log/
user: ~/.znc/users/$USER/moddata/log/
network: ~/.znc/users/$USER/networks/$NETWORK/moddata/log/
I will refer to this path as BASE_PATH below

Based on above when giving an argument of $WINDOW, one would expect the log to be created at BASE_PATH/$WINDOW/. However, the observed behavior is BASE_PATH/$WINDOW/DEFAULT_PATH.
DEFAULT_PATH being one of the paths defined in the wiki page.

The third argument of the *log module is said to set a relative path where to store logs. It would be relative to one of the following depending on how the module is loaded. global: ~/.znc/moddata/log/ user: ~/.znc/users/$USER/moddata/log/ network: ~/.znc/users/$USER/networks/$NETWORK/moddata/log/ I will refer to this path as `BASE_PATH` below Based on above when giving an argument of `$WINDOW`, one would expect the log to be created at `BASE_PATH/$WINDOW/`. However, the observed behavior is `BASE_PATH/$WINDOW/DEFAULT_PATH`. `DEFAULT_PATH` being one of the paths defined in the wiki page. <!-- github-sync-id:437477652 -->
adam closed this issue 2026-10-05 04:52:16 +02:00
Author
Owner

Uhm. What exactly do you expect when you give a directory name as the path to log to? The module needs a file name to write to.

Specifically, this code happens:
https://github.com/znc/znc/blob/09a514ba02c6f0285ac3738b15a0adcd860af85f/modules/log.cpp#L364-L392
When the given path is a folder or does not contain $USER / $WINDOW / $NETWORK (depending on which level the module is loaded on), then append the default file name and path to the given log path.

Uhm. What exactly do you expect when you give a directory name as the path to log to? The module needs a file name to write to. Specifically, this code happens: https://github.com/znc/znc/blob/09a514ba02c6f0285ac3738b15a0adcd860af85f/modules/log.cpp#L364-L392 When the given path is a folder or does not contain `$USER` / `$WINDOW` / `$NETWORK` (depending on which level the module is loaded on), then append the default file name and path to the given log path. <!-- github-comment-id:486931133 -->
Author
Owner

I also tried that. When giving %Y-%m-%d.log as an argument to *log loaded in global settings. Log files are created here: ~/.znc/moddata/log/2019-04-26.log/newdimension/freenode/#znc

Edit: Are saying that the path needs to have the following?
Global requires $USER, $WINDOW AND $NETWORK
Network requires $WINDOW
User requires $WINDOW and $NETWORK

Edit 2: Above confirmed. Ended up using an argument of $NETWORK_$USER/$WINDOW.log to minimize nesting. Is there a way to strip $WINDOW of the quotes? I'm getting '#znc.log'

I also tried that. When giving `%Y-%m-%d.log` as an argument to *log loaded in global settings. Log files are created here: `~/.znc/moddata/log/2019-04-26.log/newdimension/freenode/#znc` Edit: Are saying that the path needs to have the following? Global requires $USER, $WINDOW AND $NETWORK Network requires $WINDOW User requires $WINDOW and $NETWORK Edit 2: Above confirmed. Ended up using an argument of `$NETWORK_$USER/$WINDOW.log` to minimize nesting. Is there a way to strip $WINDOW of the quotes? I'm getting `'#znc.log'` <!-- github-comment-id:486931964 -->
Author
Owner

That's your bash's autocompletion. It's not part of filename. You can confirm with ls.

That's your bash's autocompletion. It's not part of filename. You can confirm with `ls`. <!-- github-comment-id:486946081 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#909