Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs are not being printed #106

Closed
fortunac opened this issue Dec 5, 2019 · 4 comments
Closed

Logs are not being printed #106

fortunac opened this issue Dec 5, 2019 · 4 comments
Labels
bug Something isn't working WP Involves the Weakest Precondition computation

Comments

@fortunac
Copy link

fortunac commented Dec 5, 2019

Log.start ~logdir:"/dev/stdout" ();

is deprecated with warning message:

main.warning> The deprecated Bap.Std.Log.start function is used.
This function does nothing. Use `Bap_main.init' instead

However, according to the documentation,

Attention: function is only needed when BAP framework is embedded in another
application. It shall not be called in BAP plugins. If you're not sure whether you need
to call it, then don't call it.
@fortunac fortunac added bug Something isn't working WP Involves the Weakest Precondition computation labels Dec 5, 2019
@ivg
Copy link

ivg commented Dec 5, 2019

When you're writing a plugin, you shouldn't start the log service, as the host program will set the logging for you.

@fortunac
Copy link
Author

fortunac commented Dec 5, 2019

Thanks Ivan! I was looking in the wrong directory for the log files. Is there also a way to have the logs printed to stdout?

@ivg
Copy link

ivg commented Dec 5, 2019

You can use the --log-dir parameter or the BAP_LOG_DIR environment variable to specify the location of the log file, e.g., bap . --log-dir=. will create a log file in the current folder.

While the Bap_main.init interface indeed allows specifying a formatter or channel as the looging output, the command line option itself is only accepting a directory. We can update the command line, and let it accept more options, including logging to stderr.

But, I honestly, don't see any reason to redirect it to a channel. You can always open the log file in emacs and enable the auto-revert-mode (if it is not enabled by default, it is a good idea to always use it). If you're not using emacs, I believe that all modern text editors are able to reload files automatically on change.

Finally, you can just use cat to output the log, e.g, bap ./exe <your-options> --log-dir=.; cat log

@fortunac
Copy link
Author

fortunac commented Dec 5, 2019

Thanks a bunch!

@fortunac fortunac closed this as completed Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working WP Involves the Weakest Precondition computation
Projects
None yet
Development

No branches or pull requests

2 participants