Upgrading to v4 involves changes to default log paths and file transport configuration.
Default Log Path Changes
On Linux and Windows, the default log path was changed to be more compatible with Electron's app.getPath('logs').
- Linux:
~/.config/{app name}/logs/{process type}.log - Windows:
%USERPROFILE%\AppData\Roaming\{app name}\logs\{process type}.log
To maintain old file paths, override file.resolvePath.
File Transport Updates
file.fileName now dynamically resolves to main.log, renderer.log, or worker.log based on the process type.- A new method
file.getFile() is available to manipulate the current log file.
Deprecations (Removed in v5)
If you are on v4, be aware that the following options/methods are deprecated and will be removed in v5:
file.file (use file.resolvePath instead)file.bytesWritten (use file.getFile().bytesWritten instead)file.fileSize (use file.getFile().size instead)file.clear() (use file.getFile().clear() instead)file.findLogPath() (use file.getFile().path instead)file.init()
// Example: Overriding default log path in v4
log.transports.file.resolvePath = (variables) => {
return path.join(variables.libraryDefaultDir, variables.fileName);
}