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

Unable to turn off / disable debug.log #4637

Closed
Yonezpt opened this issue Mar 27, 2016 · 9 comments
Closed

Unable to turn off / disable debug.log #4637

Yonezpt opened this issue Mar 27, 2016 · 9 comments
Assignees
Milestone

Comments

@Yonezpt
Copy link

Yonezpt commented Mar 27, 2016

Supposedly the debug.log file should no longer be created by default since 9a4562b

However it keeps creating a debug.log file whenever the app runs. I already tried "chromium-args": "disable-logging" and "chromium-args": "--disable-logging" but the debug.log file keeps being generated.

I've only noticed this file because it was reaching an extremely large size. While I can delete it myself periodically or perhaps even create a routine to do it, this is not an ideal behavior for end users.

I did test this with the Normal NWJS version expecting this to be linked to SDK, but the behavior still stands.

Either the debug.log should be disabled unless the user adds the flag to enable it or the opposite, either way as it currently stands the debug.log file cannot be disabled by any means.

NWJS Normal: v0.13.1
OS: Win7x64

@rogerwang rogerwang added this to the 0.13.x milestone Mar 27, 2016
@rogerwang rogerwang assigned rogerwang and ghostoy and unassigned rogerwang Mar 27, 2016
@Yonezpt Yonezpt changed the title Unable to turn disable debug.log Unable to turn off / disable debug.log Mar 28, 2016
ghostoy pushed a commit to ghostoy/chromium.src that referenced this issue Mar 28, 2016
On Windows, logging module is initialized after sandbox creation.
But NW package is initialized ealier that that, which causes the
creation of `debug.log` no matter if `--enable-logging` or
`--disable-logging` is set. The patch moved the initialization of
NW package after logging is initialized.

The limitation is that logging CLI argument can't be passed by
`chromium-args` in nw package, because nw package is initialized
after the logging initialization.

Fixed nwjs/nw.js#4637
ghostoy pushed a commit to ghostoy/chromium.src that referenced this issue Mar 29, 2016
On Windows, logging module is initialized after sandbox creation.
But NW package is initialized ealier that that, which causes the
creation of `debug.log` no matter if `--enable-logging` or
`--disable-logging` is set. The patch moved the initialization of
NW package after logging is initialized.

The limitation is that logging CLI argument can't be passed by
`chromium-args` in nw package, because nw package is initialized
after the logging initialization.

Fixed nwjs/nw.js#4637
ghostoy pushed a commit to ghostoy/chromium.src that referenced this issue Mar 29, 2016
On Windows, logging module is initialized after sandbox creation.
But NW package is initialized ealier that that, which causes the
creation of `debug.log` no matter if `--enable-logging` or
`--disable-logging` is set. The patch moved the initialization of
NW package after logging is initialized.

The limitation is that logging CLI argument can't be passed by
`chromium-args` in nw package, because nw package is initialized
after the logging initialization.

Fixed nwjs/nw.js#4637
ghostoy pushed a commit to ghostoy/chromium.src that referenced this issue Mar 29, 2016
On Windows, logging module is initialized after sandbox creation.
But NW package is initialized ealier that that, which causes the
creation of `debug.log` no matter if `--enable-logging` or
`--disable-logging` is set. The patch moved the initialization of
NW package after logging is initialized.

The limitation is that logging CLI argument can't be passed by
`chromium-args` in nw package, because nw package is initialized
after the logging initialization.

Fixed nwjs/nw.js#4637
ghostoy pushed a commit to ghostoy/chromium.src that referenced this issue Mar 29, 2016
On Windows, logging module is initialized after sandbox creation.
But NW package is initialized ealier that that, which causes the
creation of `debug.log` no matter if `--enable-logging` or
`--disable-logging` is set. The patch moved the initialization of
NW package after logging is initialized.

The limitation is that logging CLI argument can't be passed by
`chromium-args` in nw package, because nw package is initialized
after the logging initialization.

Fixed nwjs/nw.js#4637
ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Mar 30, 2016
nw::Package was initialized before logging module. Log in constructor
will cause creating another log file inaccidentally.

Fixed nwjs#4637
ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Mar 30, 2016
nw::Package was initialized before logging module. Log in constructor
will cause creating another log file.

Fixed nwjs#4637
@Yonezpt
Copy link
Author

Yonezpt commented Apr 6, 2016

Looks like this problem returned/is present in current NWJS 0.14.0 rc2, probably a regression or perhaps the current fix in 13 was never applied to 14.

@rogerwang
Copy link
Member

The fix was merged to the branch for 0.14 after 0.14.0-rc2. It's in the nightly build:

http://dl.nwjs.io/live-build/04-07-2016/9e26cf8-4903036-1df60de-98bfcac

@Yonezpt
Copy link
Author

Yonezpt commented Apr 7, 2016

Glad to hear that, I wasn't aware of rc3 yet.

@Yonezpt
Copy link
Author

Yonezpt commented Apr 7, 2016

On Win7x64 sdk0.13.3 and sdk0.14.0rc3 the issue appears to be mostly fixed so far, but error messages are still going through to the debug log and only error messages, nothing else.

The one I keep receiving is as follows:

[0407/223545:ERROR:image_metadata_extractor.cc(114)] Couldn't load libexif. 126

It is spontaneous and I haven't yet manged to find a way to replicate it for a reproducible case. Don't know if error messages are supose to ignore logging by design, but if they are then this is working as it is suppose to.

@rogerwang rogerwang reopened this Apr 7, 2016
@rogerwang
Copy link
Member

@ghostoy please check the error msg case. debug.log in the binary directory should be able to turn off completely. It should behave as https://www.chromium.org/for-testers/enable-logging

@ghostoy
Copy link
Member

ghostoy commented Apr 8, 2016

@rogerwang This logging is because of decoding corrupted image file, for example bad icon provided in package.json. We can ship libexif to prevent logging just like Chrome.

But libexif is deprecated in latest Chromium upstream. See https://chromium.googlesource.com/chromium/src/+/cd96b6f874573d7089bf2eb9d54ed53d7469bb56.

@rogerwang
Copy link
Member

why the log goes to debug.log, not chrome_debug.log in user data dir?

@ghostoy
Copy link
Member

ghostoy commented Apr 8, 2016

Every log message created by LOG(severity) will be output to g_log_file_name if g_logging_destination contains LOG_TO_FILE flag.

It happens on Windows only because g_logging_destination is initialized to LOG_TO_FILE on Windows, but set to LOG_TO_SYSTEM_DEBUG_LOG on other OSes (see https://github.com/nwjs/chromium.src/blob/nw13/base/logging.h#L158-L160). Then g_log_file_name will be initialized to debug.log on the side of nw.exe. If the log file creation fails, it will try to create debug.log in current directory.

We can try to init g_logging_destination to LOG_TO_SYSTEM_DEBUG_LOG on Windows. This will fix this issue completely, but there may be some side effects we don't know.

ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Apr 13, 2016
libexif is loaded on Windows at start up. When loading failed, it
will generate debug.log in the same directory of nw.exe without
`--enable-logging`. Ship `libexif.dll` with NW.js will fix this issue.
On Mac OS X, it's already shipped with NW.js. On Linux, it loads
`libexif.so.12` in system path.

Fixed nwjs#4637
@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

rogerwang pushed a commit that referenced this issue Apr 15, 2016
libexif is loaded on Windows at start up. When loading failed, it
will generate debug.log in the same directory of nw.exe without
`--enable-logging`. Ship `libexif.dll` with NW.js will fix this issue.
On Mac OS X, it's already shipped with NW.js. On Linux, it loads
`libexif.so.12` in system path.

Fixed #4637
wanghongjuan added a commit to wanghongjuan/nw.js that referenced this issue May 24, 2018
- Add test for issue nwjs#4637
- This test is passed on v0.13.1 and v0.30.5
wanghongjuan added a commit to wanghongjuan/nw.js that referenced this issue May 24, 2018
- Add test for issue nwjs#4637
- This test is passed on v0.13.1 and v0.30.5
@wanghongjuan wanghongjuan self-assigned this May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants