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

V3: Use xplatform for logging #4071

Merged
merged 8 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
All notable changes to the Zowe Installer will be documented in this file.

## `3.0.1`
- Bugfix: When `--log-dir` parameter for `zwe` command is a file, there might be an error "InternalError: stack overflow". [#40nn](https://github.com/zowe/zowe-install-packaging/pull/40nn)
- Bugfix: When logging `zwe` command, sometimes the log has wrong file tag and the log is unreadable. [#4071](https://github.com/zowe/zowe-install-packaging/pull/4071)
- Bugfix: When `--log-dir` parameter for `zwe` command is a file, there might be an error "InternalError: stack overflow". [#4064](https://github.com/zowe/zowe-install-packaging/pull/4064)
- Enhancement: new javascript funtion `getStatvfs()` to obtain information about the file sysytem [#3994](https://github.com/zowe/zowe-install-packaging/pull/3994)
- Enhancement: command `zwe diagnose` in javascript only [#4061](https://github.com/zowe/zowe-install-packaging/pull/4061)
- Enhancement: schema validation update for `zowe.job.name` and `zowe.job.prefix` [#4060](https://github.com/zowe/zowe-install-packaging/pull/4060)
Expand Down
33 changes: 9 additions & 24 deletions bin/libs/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,36 +128,21 @@ export function date(...args: string[]): string|undefined {


let logExists = false;
let logFile:std.File|null = null;

function writeLog(message: string): boolean {
const filename = std.getenv('ZWE_PRIVATE_LOG_FILE');
if (!filename) {
return false;
}
logExists = fs.fileExists(filename);
if (!logExists) {
const filename = std.getenv('ZWE_PRIVATE_LOG_FILE');
if (filename) {
fs.createFile(filename, 0o640, message);
logExists = fs.fileExists(filename);
if (!logExists) {
fs.createFile(filename, 0o640, message);
logExists = fs.fileExists(filename);
}
if (logExists) {
let errObj = {errno:undefined};
logFile = std.open(filename, 'w', errObj);
if (errObj.errno) {
printError(`Error opening file ${filename}, errno=${errObj.errno}`);
logFile=null;
logExists=false;
return false;
}
}
}
}
if (logFile===undefined || logFile===null) {
return false;
} else {
//TODO this does utf8. should we flip it to 1047 on zos?
logFile.puts(message);
return true;
xplatform.appendFileUTF8(filename, xplatform.AUTO_DETECT, message);
return true;
}
return logExists;
}


Expand Down
Loading