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

Remove logging in native code #38

Open
Marcono1234 opened this issue Jan 10, 2021 · 3 comments · May be fixed by #45
Open

Remove logging in native code #38

Marcono1234 opened this issue Jan 10, 2021 · 3 comments · May be fixed by #45

Comments

@Marcono1234
Copy link
Contributor

The native code uses logging (NSLog) quite extensively. I am not familiar with Objective-C, but the documentation for this function says:

Logs an error message to the Apple System Log facility.

However, it is currently used for debug logging as well. And it is used in cases where a Java exception is thrown anyways so logging seems redundant (instead the exception message should be improved, if necessary).

Therefore I would recommend completely removing logging.

Note: It appears the build process was slightly incorrect, using an outdated libjcocoa.dylib, see 8266cd9. Therefore you might not have seen logging output yet.

@mojo2012
Copy link
Collaborator

Removing logging doesn't seem like a good idea. Why would you want that? It helps you to follow the flow in the native code (can't really debug it or at least nobody knows how to)

@Marcono1234
Copy link
Contributor Author

Ideally the project would be stable enough at some point to not require any logging at all, or where appropriate detailed exceptions are thrown. Log ouput might also reveal sensitive information, it would be better to let the user choose how they want to handle exceptions and what (if any) they want to log.

Additionally depending on your setup you might not even be able to read the log if you run this library without capturing the standard output/error stream.

Currently with these log statements the build log looks like this:
Build log screenshot
(see https://github.com/shannah/Java-Objective-C-Bridge/runs/1678219378)
I assume it does not look much better if you would run it in production.

@shannah
Copy link
Owner

shannah commented Jan 11, 2021

I agree. That's too verbose. But I also agree that it can be nice to have verbose logging like this during debugging. Perhaps a setDebugMode(boolean) to enable/disable this logging would be best.

DJtheRedstoner added a commit to DJtheRedstoner/Java-Objective-C-Bridge that referenced this issue Jun 14, 2022
DJtheRedstoner added a commit to DJtheRedstoner/Java-Objective-C-Bridge that referenced this issue Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants