Skip to content

Commit

Permalink
build: fix behavior of log_proxy_wrapper when timestamp_prefix is NULL
Browse files Browse the repository at this point in the history
(every log line starting by "(null)")
  • Loading branch information
thebaptiste committed Feb 8, 2024
1 parent 262d47a commit 08858fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .metwork-framework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ It can be used to avoid loosing some logs if you use `logrotate` with `copytrunc
## Features

- [x] usable as a pipe (`myapp myapp_arg1 myapp_arg2 |log_proxy /log/myapp.log`)
- [x] configurable log rotation suffix with `stftime` placeholders (for example: `.%Y%m%d%H%M%S`)
- [x] configurable log rotation suffix with `strftime` placeholders (for example: `.%Y%m%d%H%M%S`)
- [x] can limit the number of rotated files (and delete oldest)
- [x] can rotate files depending on their size (in bytes)
- [x] can rotate files depending on their age (in seconds)
- [x] does not need a specific log directory for a given app (you can have one directory with plenty of different log files from different apps)
- [x] several instances of the same app can log to the same file without issue (example: `myapp arg1 |log_proxy --use-locks /log/myapp.log` and `myapp arg2 |log_proxy --use-locks /log/myapp.log` can run at the same time)
- [ ] configurable action (a command to execute) to run after each log rotation
- [ ] rock solid (it's perfectly stable in our use case but we are waiting for other success stories to check this feature)
- [ ] option to add a timestamp before each log line
- [x] option to add a timestamp before each log line, thanks to [mk-fg](https://github.com/mk-fg)
- [x] really fast
- [x] do not eat a lot of memory
- [x] configurable with CLI options as well with env variables
Expand Down
1 change: 1 addition & 0 deletions src/log_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ int main(int argc, char *argv[])
signal(SIGTERM, signal_handler);
signal(SIGINT, signal_handler);
set_default_values_from_env();
if ( strcmp( timestamp_prefix, "(null)" ) == 0 ) timestamp_prefix = NULL;
log_file = compute_file_path(log_directory, argv[1]);
// Create log directory if not existing
gchar *log_dir = g_path_get_dirname(log_file);
Expand Down

0 comments on commit 08858fe

Please sign in to comment.