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

Update SDK Logger to output to any directory #751

Closed
littleaj opened this issue Sep 27, 2018 · 3 comments
Closed

Update SDK Logger to output to any directory #751

littleaj opened this issue Sep 27, 2018 · 3 comments
Assignees
Milestone

Comments

@littleaj
Copy link
Contributor

Right now, our logging has two options: CONSOLE or FILE.
CONSOLE prints to stdout.
FILE writes to a file, always relative to java.io.tmpdir (source) and this is the issue. In some environments, the directory to java.io.tmpdir is not accessible and the property cannot be overridden.

solution
The file path can be set with the XML element <BaseFolder />
If the specified path is absolute, use that exact path.
If the specified path is relative, use that path relative to java.io.tmpdir.

possible fallout
On windows: if someone currently has the BaseFolder set to a path with a leading slash, e.g. \mylogdir, then after this change, logs will then be written to the default drive instead of under java.io.tmpdir.
On Linux: same issue. leading slash would write to a different directory.

Note: if the file logger cannot write (e.g. if writing to file throws an IOException), it falls back to console logger. In the examples above, this will be the case if the application cannot write to /.

additional tasks
Update https://github.com/Microsoft/ApplicationInsights-Java/wiki/ApplicationInsights.XML with a description of the new functionality.

@littleaj littleaj added this to the 2.2.1 milestone Sep 27, 2018
@littleaj littleaj self-assigned this Sep 27, 2018
@dhaval24
Copy link
Contributor

@littleaj and @grlima we should consider this proposal carefully. I believe it might open any security concerns, as it is very possible that logs may contain sensitive customer information.

@littleaj
Copy link
Contributor Author

littleaj commented Oct 2, 2018

Planning to implement via slf4j #309

@dhaval24
Copy link
Contributor

Closing as the PR is merged and released.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants