79753047

Date: 2025-09-02 03:45:00
Score: 1.5
Natty:
Report link

Almost all answers in this post are not working for me, they seem to be deprecated.

path.join(__dirname, '/logsmain.log');

The above code will produce a path inside app.asar, and this does not work because electron-log writes logs inside app.asar

import { app } from 'electron';
import log from 'electron-log/main';
import path from 'path';

const executablePath = app.getPath('exe');
const executableDirectory = path.dirname(executablePath);
log.transports.file.resolvePathFn = () => path.join(executableDirectory, 'logs/main.log');
log.transports.file.level = 'debug';
log.transports.file.level = "info"

export { log as logger };

The above code works for me.

Reasons:
  • Whitelisted phrase (-1): works for me
  • RegEx Blacklisted phrase (3): not working for me
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: MinhSu - Justin