Note: I suggest this as a topic for all Q&A related to the testnet command.
I’m running local test networks using the testnet command and having trouble getting the logs to contain anything other than INFO or WARN messages. I tried the following which made no difference. RUST_LOG=safe_network=trace testnet RUST_LOG=sn_node=trace testnet
Using RUST_LOG=trace testnet causes a panic which reports that sn_node was passed -vv which is equivalent to info!
Is there a way to get TRACE output in the logs when using testnet?
UPDATE:
The following does in fact work (as @joshuef says it should).
My problem appears to have been my system caching the files for a terminal window, possibly because I had removed the current directory for that terminal. The directory listing was still showing the files from yesterday until I changed directory and I guess commands in that window were seeing cached files rather than the new directories and their contents.
Thanks @joshuef, I’m running a very similar combo command so odd that I’m not getting the same result. Will try again later. Just to confirm, the text ‘TRACE’ should appear in the logs?
The proliferation of options here may potentially be more confusing. I personally don’t think there’s really a need for both sn_launch_tool and the CLI mechanism for launching a local network, and possibly not testnet either.
I wanted to do some work in making things a bit more uniform. Should hopefully be able to soon.
ok so I tried to safe files put and I get that files is not a command, run safe --help and it is not listed there. I remember that you need to use otlp feature, how to enable that with testnet?
cargo flamegraph --bin sn_node --root -- --first --help
Finished release [optimized] target(s) in 0.38s
warning: the following packages contain code that will be rejected by a future version of Rust: ntapi v0.3.7, quick-xml v0.22.0
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 8`
WARNING: profiling without debuginfo. Enable symbol information by adding the following lines to Cargo.toml:
[profile.release]
debug = true
Or set this environment variable:
CARGO_PROFILE_RELEASE_DEBUG=true
sn_node 0.78.4
Node configuration
USAGE:
sn_node [OPTIONS]
OPTIONS:
--clear-data
Delete all data from a previous node running on the same PC
--completions <COMPLETIONS>
dump shell completions for: [bash, fish, zsh, powershell, elvish]
--first <FIRST>
Make this the node the first on the network. This requires an address where it's
reachable for by other nodes. This address will be put in the network contacts file.
If the port is `0`, then the will be equal to whatever port we will locally bind to.
-h, --help
Print help information
-j, --json-logs
Outputs logs in json format for easier processing
--local-addr <LOCAL_ADDR>
Local address to be used for the node.
When unspecified, the node will listen on `0.0.0.0` with a random unused port. If you're
running a local-only network, you should set this to `127.0.0.1:0` to prevent any
external traffic from reaching the node (but note that the node will also be unable to
connect to non-local nodes).
--log-dir <LOG_DIR>
Send logs to a file within the specified directory
--logs-max-bytes <LOGS_MAX_BYTES>
Maximum bytes per log file
[default: 10485760]
--logs-max-lines <LOGS_MAX_LINES>
Maximum lines per log file (overrides logs_max_bytes)
[default: 0]
--logs-retained <LOGS_RETAINED>
Number of rotated log files to keep (0 to keep all)
[default: 0]
--logs-uncompressed <LOGS_UNCOMPRESSED>
Number of rotated files left not compressed
[default: 100]
-n, --network-contacts-file <NETWORK_CONTACTS_FILE>
File with initial network contacts to bootstrap to if this node is not the first on the
network. This argument and the `--first` flag are mutually exclusive.
This shall be set to the file path where a valid `SectionTree` can be read from.
-r, --root-dir <ROOT_DIR>
Root directory for dbs and cached state. If not set, it defaults to "root_dir" within
the sn_node project data directory, located at: Linux: $HOME/.safe/node/root_dir
Windows: {FOLDERID_Profile}/.safe/node/root_dir MacOS: $HOME/.safe/node/root_dir
--resource-logs
print node resourse usage to stdout
--update
Update sn_node to the latest available version
-v, --verbose
Verbose output. `-v` is equivalent to logging with `warn`, `-vv` to `info`, `-vvv` to
`debug`, `-vvvv` to `trace`. This is overridden by the `RUST_LOG` environment variable
-V, --version
Print version information
-w, --wallet-id <WALLET_ID>
The address to be credited when this node farms SafeCoin. A hex formatted BLS public key
-y, --no-confirm
Do not prompt to confirm the update
writing flamegraph to "flamegraph.svg"
its like you dont want us to launch comnets? that is without using Digital Ocean and sn_testnet_tool
@Southside do you have a script to create a “public” testnet? I am getting a bit uneasy that I cant make a smoothnet…