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

Provide a FileSystemLogger in the framework #10559

Open
luettmaSICKAG opened this issue Dec 17, 2021 · 2 comments
Open

Provide a FileSystemLogger in the framework #10559

luettmaSICKAG opened this issue Dec 17, 2021 · 2 comments
Assignees
Labels
proposal feature proposals (potential future features)

Comments

@luettmaSICKAG
Copy link

Currently the logs of a Theia application are only printed to the console.
The "@theia/plugin-ext" extension creates a log directory for each session in $CONFIG_DIR/logs/{TIMESTAMP}.
This seems to be used solely for Theia plugins/VSCode extension (vscode.ExtensionContext.logUri);

We created our own FileSystem logger which writes to $CONFIG_DIR/logs/application-{TIMESTAMP}.log.
The problem here is that we couldn't get the path to the logdir of the current session, because the timestamp is created on the fly and not exposed.

Feature Description:

It would be a great core feature if Theia provided a default implementation of a Logger that stores the messages on the file system.
Either by providing a default implementation or configuration.

@vince-fugnitto vince-fugnitto added the proposal feature proposals (potential future features) label Dec 17, 2021
@vince-fugnitto
Copy link
Member

@luettmaSICKAG thank you for the issue 👍

The problem here is that we couldn't get the path to the logdir of the current session, because the timestamp is created on the fly and not exposed.

I'm not sure I follow as to why moving this logger to the framework would fix the problem, rather this seems to be an issue with the custom implementation included in your application?

@luettmaSICKAG
Copy link
Author

I'm not sure I follow as to why moving this logger to the framework would fix the problem, rather this seems to be an issue with the custom implementation included in your application?

The problem was actually that there is no constant / variable exposed that points to the log directory.
The best I could do was to get the CONFIG_DIR and by implicit knowledge the "logs" directory.

@theia/plugin-ext creates a subfolder for the session using a timestamp. I though it'd make sense to store the application log and plugin logs in that "session directory".

Right now this logs directory is only created for plugins.

const pluginDirPath = path.join(parentLogsDir, this.generateTimeFolderName(), 'host');

The problems are:

  • A custom logger extension should not require a dependency to @theia/plugin-ext to get the log path
  • Even if we used PluginPathsService.getHostLogPath() it would create a new path

Anyway, it was just a very quick implementation on our side, since we hoped that the logging mechanisms (including log rotation etc) would make it to the framework.

@msujew msujew self-assigned this Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal feature proposals (potential future features)
Projects
None yet
Development

No branches or pull requests

3 participants