Skip to content

Studio Logs: Could not open log file on Studio when error occurred on Windows - #1243

Closed
gavande1 wants to merge 3 commits into
trunkfrom
stu-102-studio-could-not-open-log-file-on-studio-when-error-occurred
Closed

Studio Logs: Could not open log file on Studio when error occurred on Windows#1243
gavande1 wants to merge 3 commits into
trunkfrom
stu-102-studio-could-not-open-log-file-on-studio-when-error-occurred

Conversation

@gavande1

@gavande1 gavande1 commented Apr 22, 2025

Copy link
Copy Markdown
Contributor

Related issues

Proposed Changes

  • Do not try to create symlink for logger file on windows

Testing Instructions

  • TBA

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@gavande1
gavande1 force-pushed the stu-102-studio-could-not-open-log-file-on-studio-when-error-occurred branch from 0427c70 to b972263 Compare April 22, 2025 14:54

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for creating this PR. I tested it, and it works as expected on Windows. My only concern is hardcoding the filename to .0.log.
I went ahead and created a PR saving the log file returned by FileStreamRotator, so it will work even if it rotates the file multiple times. Let me know what you think.

Comment thread src/logging.ts
app.setAppLogsPath();
}

const isWindows = platform() === 'win32';

@sejas sejas Apr 22, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a function isWindows but it seems it only works in the front-end. So It's ok to make the comparison here.

Comment thread src/logging.ts
Comment on lines +46 to +47
const today = new Date().toISOString().split( 'T' )[ 0 ].replace( /-/g, '' );
currentLogFile = path.join( logDir, `studio-${ today }.0.log` );

@sejas sejas Apr 22, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know our current log file size is 5MB, and the chances of reaching that limit are very low, but in theory, it's possible, and in those cases, the .0.log will fail. Building the date from scratch seems a bit flaky. What do you think about setting the current log file dynamically?

@gavande1

Copy link
Copy Markdown
Contributor Author

Thanks, @sejas, for your review. Your PR #1245 is undoubtedly a better approach in terms of cross-platform parity.

@gavande1

Copy link
Copy Markdown
Contributor Author

I am closing this PR in favour of #1245.

@gavande1 gavande1 closed this Apr 23, 2025
@gavande1 gavande1 self-assigned this May 8, 2025
@wojtekn
wojtekn deleted the stu-102-studio-could-not-open-log-file-on-studio-when-error-occurred branch May 13, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants