Open 3eka opened 2 years ago
6.8.0
@3eka Did you try the logging option?
Tests done with version 6.8.1...
:; n3dr --help
...
--logFile write the log to syslog
--logLevel string change the log level
...
Q1: Why --logFile
goes to syslog (I would expect options, like syslog
or /path/log_file_name.log
)?
Q2: Would be nice to display options for --logLevel
(had to dig into code to find that info, debug and trace are allowed options)
Using --basePathPrefix
and --logLevel=info
INFO[2022-11-04T16:15:36+01:00]/n3dr/cmd/n3dr/root.go:80 main.n3drHiddenHome() n3drHomeDir: '/export/home/predrag_zecevic/.n3dr'
INFO 2022/11/04 16:15:36 trying to resolve absolute path path=/export/home/predrag_zecevic/.n3dr
INFO 2022/11/04 16:15:36 adding path to search paths path=/export/home/predrag_zecevic/.n3dr
INFO 2022/11/04 16:15:36 attempting to read in config file
INFO 2022/11/04 16:15:36 searching for config in paths paths=[/export/home/predrag_zecevic/.n3dr]
INFO[2022-11-04T16:15:36+01:00]/n3dr/cmd/n3dr/root.go:202 main.parseConfig() Using config file: '/export/home/predrag_zecevic/.n3dr/config.yml'
INFO[2022-11-04T16:15:36+01:00]/n3dr/internal/app/n3dr/artifactsv2/download.go:212 github.com/030/n3dr/internal/app/n3dr/artifactsv2.(*Nexus3).Backup() backing up 'npm_group', 'group', npm
...
INFO[2022-11-04T16:25:10+01:00]/n3dr/internal/app/n3dr/artifactsv2/download.go:212 github.com/030/n3dr/internal/app/n3dr/artifactsv2.(*Nexus3).Backup() backing up 'test-raw', 'hosted', raw
*******%%++++++++++++++++++++++++++++++%+*+++++++*+**?*******?*??*?*?????+++????????+++++++++++++++++
Timestamp output is not consolidated, but all seems OK (except legend what all those characters, displayed during backup means)
Backup of second Nexus instance (no prefix) with --logLevel=info
INFO[2022-11-04T16:30:10+01:00]/n3dr/cmd/n3dr/root.go:80 main.n3drHiddenHome() n3drHomeDir: '/export/home/predrag_zecevic/.n3dr'
INFO 2022/11/04 16:30:10 trying to resolve absolute path path=/export/home/predrag_zecevic/.n3dr
INFO 2022/11/04 16:30:10 adding path to search paths path=/export/home/predrag_zecevic/.n3dr
INFO 2022/11/04 16:30:10 attempting to read in config file
INFO 2022/11/04 16:30:10 searching for config in paths paths=[/export/home/predrag_zecevic/.n3dr]
INFO[2022-11-04T16:30:10+01:00]/n3dr/cmd/n3dr/root.go:202 main.parseConfig() Using config file: '/export/home/predrag_zecevic/.n3dr/config.yml'
INFO[2022-11-04T16:30:10+01:00]/n3dr/internal/app/n3dr/artifactsv2/download.go:212 github.com/030/n3dr/internal/app/n3dr/artifactsv2.(*Nexus3).Backup() backing up 'my-yum', 'hosted', yum
INFO[2022-11-04T16:30:10+01:00]/n3dr/internal/app/n3dr/artifactsv2/download.go:212 github.com/030/n3dr/internal/app/n3dr/artifactsv2.(*Nexus3).Backup() backing up 'nuget-group', 'group', nuget
INFO[2022-11-04T16:30:10+01:00]/n3dr/internal/app/n3dr/artifactsv2/download.go:212 github.com/030/n3dr/internal/app/n3dr/artifactsv2.(*Nexus3).Backup() backing up 'maven-snapshots', 'hosted', maven2
INFO[2022-11-04T16:30:10+01:00]/n3dr/internal/app/n3dr/artifactsv2/download.go:212 github.com/030/n3dr/internal/app/n3dr/artifactsv2.(*Nexus3).Backup() backing up 'maven-central', 'proxy', maven2
INFO[2022-11-04T16:30:10+01:00]/n3dr/internal/app/n3dr/artifactsv2/download.go:212 github.com/030/n3dr/internal/app/n3dr/artifactsv2.(*Nexus3).Backup() backing up 'nuget.org-proxy', 'proxy', nuget
INFO[2022-11-04T16:30:10+01:00]/n3dr/internal/app/n3dr/artifactsv2/download.go:212 github.com/030/n3dr/internal/app/n3dr/artifactsv2.(*Nexus3).Backup() backing up 'maven-releases', 'hosted', maven2
INFO[2022-11-04T16:30:10+01:00]/n3dr/internal/app/n3dr/artifactsv2/download.go:212 github.com/030/n3dr/internal/app/n3dr/artifactsv2.(*Nexus3).Backup() backing up 'my-docker', 'hosted', docker
FATA[2022-11-04T16:30:10+01:00]/n3dr/cmd/n3dr/repositoriesV2.go:70 main.glob..func7() parse ":0/v2/_catalog": missing protocol scheme
Died? But logging is OK (same notice as for above attempt is true)
There is no difference between debug and trace log levels. I have few observations:
A) I would expect in either debug or trace log level explanation where and why it has died in more details (for example, I am not sure if it has died on my-docker
backup or trying to fetch info for next one (in my case `my-raw
repository)
B) Specifying either log level (debug or trace) following is displayed on screen
DEBU[2022-11-04T16:31:55+01:00]/export/home/predrag_zecevic/go/pkg/mod/github.com/030/p2iwd@v0.2.0/internal/pkg/http/http.go:20 github.com/030/p2iwd/internal/pkg/http.(*Auth).RequestAndResponse() Auth: '&{Accept GET PASSWORD_SHOWN_HERE! :0/v2/_catalog predrag_zecevic}'
FATA[2022-11-04T16:31:55+01:00]/n3dr/cmd/n3dr/repositoriesV2.go:70 main.glob..func7() parse ":0/v2/_catalog": missing protocol scheme
password is visible, should be masked.
Thanks for update. Best regards.
P.S. It seems that I still have 2 problems:
Case 1) - it dies often after some period if running time w/o finishing job (maybe Nexus kicks it out, because it thinks someone is DDOS-ing?). Not so important, because if I repeat it several times, it finishes
Case 2) - seems raw
repository causes error "missing protocol schema"
This is my config file:
:; cat /export/home/predrag_zecevic/.n3dr/config.yml
removeLocalFile: true
@3eka Could you create another issue to address "the raw repository and FATA[2022-11-04T16:30:10+01:00]/n3dr/cmd/n3dr/repositoriesV2.go:70 main.glob..func7() parse ":0/v2/_catalog": missing protocol scheme" issue?
Example: n3dr repositoriesV2 --backup -u some-user -p some-pass -n localhost:9000 --https=false --directory-prefix /tmp/some-dir --dockerPort 9001 --dockerHost http://localhost --logFile some-file.log --logLevel trace --syslog
7.0.0
Sorry, I have missed your latest update completely.
Let us focus on logging:
Thanks and regards
HI @030 ,
can you describe a bit logging logic?
I am expecting following:
--logFile=/path/to/log/file
is specified, ALL output should end there. Right now, tool sends to stdout (even with --logLevel=none
settings). This is when I was running backup, then Nexus service restart has stopped it, and I have started same command again:
INFO[0000] n3drHomeDir: '/export/home/predrag_zecevic/.n3dr'
INFO[0000] Using config file: '/export/home/predrag_zecevic/.n3dr/config.yml'
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++....
Rest is sent to log file
--logMethod={new,overwrite}
)I still have to check all logging level options Regards.
What would you like to be added: I would like to have an option to fine tune logging (like: INFO, WARN, ERROR, etc -- with NONE option too). Or, some errors I want to see on the screen (like ERROR), other can go into file (like INFO ones)
Why is this needed: Because, it is really annoying. Few examples:
--basePathPrefix
switch is usedAs you might see n3dr keeps repeating following, every time when it advances to the next item, which make it hard to follow: