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

Symlink not created on windows10 #365

Open
danielj13LR opened this issue Jan 1, 2023 · 3 comments
Open

Symlink not created on windows10 #365

danielj13LR opened this issue Jan 1, 2023 · 3 comments

Comments

@danielj13LR
Copy link

danielj13LR commented Jan 1, 2023

this is my transport configuration, it works on windows 11, linux, mac etc but for some reason not on windows 10.

{
      dirname: os.tempdir(),
      filename: 'myLogFile',
      datePattern: 'YYYY-MM-DD-HH',
      createSymlink: true,
      symlinkName: 'myLogFile',
      maxSize: '2k',
      maxFiles: '5',
    }

im only getting the file with date (meaning 'myLogFile2023-01-01-16-02')
tried to add extension but it didn't help.
I'm using version 4.7.1.
I tried finding some issues that discuss this problem but found non from this version.
also tried this demo from stackoverflow which didnt work.

var os = require('os');
var winston = require('winston');
require('winston-daily-rotate-file');

var transport = new winston.transports.DailyRotateFile({
    dirname: os.tmpdir(),
    frequency: '1m',
    filename: 'log',
    datePattern: 'YYYY-MM-DD-HH-mm',
    zippedArchive: false,
    maxSize: '1k',
    maxFiles: '2',
    extension: '.log'

});

var logger = winston.createLogger({
    transports: [
        transport
    ]
});

async function demo() {
    for (i = 1; i < 20; i++) {
        logger.info('Hello World ' + i);
        console.log(i);
        await new Promise(r => setTimeout(r, 10000));
    }
}

demo();

any suggestions ? is it a known bug?

@kafeijao
Copy link

kafeijao commented Feb 4, 2023

I have the same issue, but on windows 10 and 4.7.1
npm: 8.19.3
node: v18.13.0

Also tested with all older versions until the 4.0.0 and also did not work.

@guatemartin
Copy link

I have the same issue, but it's running on windows server 2019. Ver is 4.7.1

@Efferbach
Copy link

I experienced the same issue on Windows 11 Pro.
winston-daily-rotatte-file: 5.0.0
winston: 3.13.0
npm: 10.2.4
node: v20.11.0
{

  filename: 'logs/debug/%DATE%-debug.log',
  level: 'debug',
  datePattern: 'YYYY-MM-DD',
  maxFiles: '30d',
  zippedArchive: true,
  createSymlink: true,
  symlinkName: 'debug.log'

}

When I run it as admin it works and the symbolic link is created and can be used as intended.

If I run without admin privileges I can't create the symbolic link. When I run it without admin privileges after I have created the symbolic link as admin, the link is deleted.

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

No branches or pull requests

4 participants