Why set log.transports.file.file doesn't work?
See original GitHub issueHello.
In my project(use electron & vue), I configure the transport formats in main.js like this.
```
const logFormat = '{h}:{i}:{s}:{ms} {text}'
log.transports.console.format = logFormat
log.transports.console.format = (msg) => util.format.apply(util, msg.data);
const appDataDir = path.join(app.getPath('appData'), 'my-project')
log.transports.file.level = 'info'
log.transports.file.format = logFormat
log.transports.file.maxSize = 5 * 1024 * 1024
log.transports.file.file = path.join(appDataDir, 'log.log')
log.transports.file.streamConfig = { flags: 'w' }
log.transports.file.stream = fs.createWriteStream('log.log')
1. This works in dev mode, except the log file does not in the path of configuration(appDataDir/log.log), but the project folder in my desktop.
2.When I build my app with electron builder and run, it shows me an error of
"**Uncaught Exception:
Error: EACCES: permission denied, open 'log.log**'"
Am I wrong with something? How can this be fixed please.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Electron app - logging to file in production - Stack Overflow
Take a look at electron log // Setup file logging const log = require('electron-log'); log.transports.file.level = 'info'; ...
Read more >[Electron][TypeScript] output/input files - DEV Community
So if I execute "log.transports.file.resolvePath" only in "main.ts", the logs of "preload.ts" are saved in "C:/Users/ ...
Read more >electron-log | Yarn - Package Manager
Transport. Transport is a simple function which does some work with log message. By default, two transports are active: console and file. If...
Read more >Winston - Best of JS
Note that the default logger doesn't have any transports by default. ... File({ filename: 'combined.log' }); const console = new winston.transports.
Read more >How to use the electron-log.transports function in ... - Snyk
To help you get started, we've selected a few electron-log.transports examples, ... store'; // Set level log.transports.file.level = 'debug'; ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In most cases, the application directory is not writable after installation. That’s why default log path is inside appData directory. I think it’s not very easy to make it writable on windows, and it’s impossible on linux and mac.
no problem)