Conversation
docker/runner.Dockerfile
Outdated
|
|
||
| RUN useradd ipc && chown -R ipc $FM_HOME_DIR | ||
|
|
||
| USER ipc No newline at end of file |
There was a problem hiding this comment.
Why do we need an ipc user instead of root here? Also, I don't think it is the case but I am wondering if this may break the execution of the fendermint container considering the directory structure that we use. Have you tried it?
There was a problem hiding this comment.
I never quite understood how to use users inside containers properly. I made images where I used add-user to create users with specific IDs and groups, but unless those IDs aligned with what exists on the host, I still had to end up setting the -u option to make sure I can remove files created into mounted volumes without sudo. Since this is a container, I never quite got why we shouldn't use root 🤷 I'm sure I'm just ignorant, but if it works...
There was a problem hiding this comment.
I removed as it's not needed anymore. But I think one day we should not use root to execute docker
fendermint/app/src/main.rs
Outdated
|
|
||
| tracing::subscriber::set_global_default(subscriber) | ||
| .expect("setting default subscriber failed"); | ||
| create_log(level, &opts.home_dir).expect("cannot create logging"); |
There was a problem hiding this comment.
I think we should add a setting to configure the output path, and if we want the log to be output on std err/std output, or to a file.
There was a problem hiding this comment.
I think it's right to do both. I had a similar thing in my Scala programs except I was able to configure them through XML, so we can enable the debug level on a package-by-package basis (third parties as well) without recompiling.
fendermint/app/src/main.rs
Outdated
|
|
||
| // debug level logger | ||
| let topdown_logger = config::Logger { | ||
| level: config::LevelFilter::DEBUG, |
There was a problem hiding this comment.
Should we make this configurable too? Now we want this in debug mode for debugging purpose, but we may want to keep the same level for all in the future.
There was a problem hiding this comment.
I would say we just keep this top down logs just in case for something unexpected. The logs will be 50mb in total, it's not taking a lot of space. But we always have some logs to refer back to.
Co-authored-by: Akosh Farkash <[email protected]>
Co-authored-by: Akosh Farkash <[email protected]>
Co-authored-by: Akosh Farkash <[email protected]>
| config | ||
| .appenders | ||
| .insert(AppenderId::from("topdown"), topdown_appender); |
There was a problem hiding this comment.
Why do we need to insert the logger into the config, when it's already set in the topdown_logger?
There was a problem hiding this comment.
I havent looked very deep into trace4rs, my guess is when an event is emitted, it checks if there are any Target watching this event, then target has a logger, and logger has an appender.
* look ahead limit use finalized height * rename variable * more comments * more logs
…dermint into tracing-logs
Co-authored-by: Akosh Farkash <[email protected]>
…dermint into tracing-logs
| tracing-subscriber = "0.3" | ||
| url = "2.4.1" | ||
| zeroize = "1.6" | ||
| trace4rs = "0.5.1" |
There was a problem hiding this comment.
Do you know if this is available on Github somewhere? I can't find a link at https://crates.io/crates/trace4rs
There was a problem hiding this comment.
fendermint/app/src/main.rs
Outdated
| config | ||
| .loggers | ||
| .insert(Target::from("fendermint_app"), debug_logger.clone()); | ||
| config | ||
| .loggers | ||
| .insert(Target::from("fendermint_vm_interpreter"), debug_logger); |
There was a problem hiding this comment.
https://docs.rs/trace4rs/0.5.1/src/trace4rs/handle/loggers.rs.html#91 suggests that a simple Target::from("fendermint") should work.
There was a problem hiding this comment.
funny thing is, with this, all logs are directly to debug and console is empty
There was a problem hiding this comment.
Maybe because it's set as a "default" which could mean "if nothing else matched"? Perhaps insert it explicitly with the "" target?
There was a problem hiding this comment.
fendermint/vm/topdown/src/sync.rs
Outdated
| "parent block hash at {height} is {:02x?} diff than previous hash: {previous_hash:02x?}", | ||
| block_hash_res.parent_block_hash | ||
| ); | ||
| heigit = hex::encode(&block_hash_res.parent_block_hash), |
There was a problem hiding this comment.
| heigit = hex::encode(&block_hash_res.parent_block_hash), | |
| height, | |
| parent_hash = hex::encode(&block_hash_res.parent_block_hash), |
Co-authored-by: Akosh Farkash <[email protected]>
…dermint into tracing-logs
| .insert(Target::from("fendermint"), debug_logger); | ||
| config | ||
| .appenders | ||
| .insert(AppenderId::from("debug"), debug_appender); |
There was a problem hiding this comment.
Yeah so why don't we insert a clone of the default console logger with an Target::from("") and the INFO level?
There was a problem hiding this comment.
yeah, but it seems to me this is a bug or sth, we should not be able to do that though. But I added this.
There was a problem hiding this comment.
What's a bug? Why shouldn't we be able to set a logger that captures everything and logs to the console if we want to?
There was a problem hiding this comment.
I mean we need to do this:
config
.loggers
.insert(Target::from("fendermint"), debug_logger);
config.loggers.insert(Target::from("fendermint"), default);but ideally we should not need config.loggers.insert(Target::from("fendermint"), default); as we already set default.
There was a problem hiding this comment.
Ah, okay, so if fendermint* will go to both debug files and console, and everything else will also go to the console because it matches all namespaces, if their log level is at least the selected one 👍
aakoshh
left a comment
There was a problem hiding this comment.
Thank you for all the changes!
Add more logging outputs options so that we still have default info log to console, but also have debug logs with rotation written to file.