11

I'm running a parity supernode, recently switched from geth because parity seems to perform much better, even in archive mode.

To log the standard output of geth, I used to run:

geth [options] console 2>>/tmp/geth.log

I tried to run similar command for parity, but it wont log the standard out.

 ~ $ parity --help | grep -A1 log
  -l --logging LOGGING     Specify the logging level. Must conform to the same
                           format as RUST_LOG.

Natively, parity allows to set a logging level. But how can I make parity actually write logs?

2 Answers 2

5

Send Stderr And Stdout To A Log File

If you want to overwrite the log file each time you start your command:

parity [options] > /tmp/parity.log 2>&1

If you want to append to your log file each time you start your command:

parity [options] >> /tmp/parity.log 2>&1



Send Stderr And Stdout To Separate Log Files While Viewing Output

And if you want to log stderr and stdout into separate log files while viewing the output on your console:

parity [options] > >(tee stdout.log) 2> >(tee stderr.log >&2)

Reference How do I write stderr to a file while using “tee” with a pipe?.

If you want to create a script file to run this command, you will have to use #!/bin/bash (instead of #!/bin/sh) in the first line of the file as this redirection is bash specific:

#!/bin/bash

cd $HOME/Parity

parity [options] > >(tee stdout.log) 2> >(tee stderr.log >&2)

Save the above into $HOME/bin/runParity, chmod 700 $HOME/bin/runParity and your can then type runParity (or $HOME/bin/runParity) to start it.

25

More recent versions of Parity allow native log file creation:

parity --log-file /path/to/parity.log

And set the log level to error, warn, info, debug or trace, with:

parity -lsync,tpc=trace

Where the following modules can be traced: account_bloom, basicauthority, chain, client, dapps, discovery, diskmap, enact, engine, estimate_gas, ethash, executive, ext, external_tx, externalities, fatdb, fetch, hypervisor, ipc, jdb, journaldb, les, les_provider, local_store, migration, miner, mode, network, on_demand, own_tx, perf, poa, rcdb, shutdown, signer, snapshot, snapshot_io, snapshot_watcher, spec, state, stats, stratum, sync, trie, txqueue, and / or updater.

Disclosure, I work for Parity.

3
  • 2
    I'm a relatively heavy user of parity. May I ask you where this level of information is available? I'm guessing it's in the wiki, but before I dive too deep, am I right? Commented Nov 25, 2017 at 22:40
  • 1
    I just grepped the source code for this :)
    – q9f
    Commented Nov 27, 2017 at 9:59
  • 3
    I used grep -R -o -E 'debug!\(target\: \"[a-z_]*\"' * | cut -d'"' -f2 | sort | uniq to create a similar list a year later (for the debug log level). Did you use something like this?.. Commented May 11, 2018 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.