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

Fix logger config #313

Merged
merged 9 commits into from
Jul 19, 2024
Merged

Fix logger config #313

merged 9 commits into from
Jul 19, 2024

Conversation

pem70
Copy link
Collaborator

@pem70 pem70 commented Jul 16, 2024

What It Does
Fixes the bug the logger config would affect other Python application logger [#314].

How to Test

Review Checklist
I certify that I have:

Additional Comments

pem70 added 2 commits July 16, 2024 15:43
Signed-off-by: pem70 <[email protected]>
Signed-off-by: pem70 <[email protected]>
@pem70 pem70 requested a review from traeok July 16, 2024 19:53
Copy link
Member

@traeok traeok left a comment

Choose a reason for hiding this comment

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

Changes look good to me, thanks Peizhao!

@pem70 pem70 requested review from t1m0thyj and zFernand0 July 16, 2024 19:59
Copy link

codecov bot commented Jul 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.85%. Comparing base (41cb81e) to head (1011d58).
Report is 142 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #313      +/-   ##
==========================================
- Coverage   90.03%   89.85%   -0.19%     
==========================================
  Files          53       53              
  Lines        2751     2808      +57     
==========================================
+ Hits         2477     2523      +46     
- Misses        274      285      +11     
Flag Coverage Δ
unittests 89.85% <100.00%> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pem70 pem70 requested a review from traeok July 17, 2024 15:00
@zFernand0 zFernand0 linked an issue Jul 17, 2024 that may be closed by this pull request
Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

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

This does resolve the problem of logging statements going to the python_sdk.log file 😋


I like the Log.close_[file/console]_output()functions. 🙏🏽

Is it expected that any logging.[debug,info,error]("test") will turn on console_output?(i.e. it's equivalent to running Log.open_console_output())

In contrast, the closeAll() function keeps the logger disabled even after a logging.[xyz]() call occurs.

Expand this section to vew a small test script
profile = ProfileManager().load(profile_type="zosmf", validate_schema=False)
ds = Datasets(profile)
console = Console(profile)
jobs = Jobs(profile)

Log.setAllLoggerLevel(logging.DEBUG)
# Log.closeAll() # Keeps console_output off
Log.close_console_output() # Gets enabled after a `logging.` call
# Log.close_file_output()

res = console.issue_command("D T") # You won't see a debug log in the console
print(res['cmd-response'])

logging.error("---- Test ----") # This turns on the consloe_output

res = ds.list('sys1.parmlib*') # You should not see a debug log in the console
for v in res["items"]:
    print(v["dsname"])

Signed-off-by: pem70 <[email protected]>
@pem70
Copy link
Collaborator Author

pem70 commented Jul 18, 2024

This does resolve the problem of logging statements going to the python_sdk.log file 😋

I like the Log.close_[file/console]_output()functions. 🙏🏽

Is it expected that any logging.[debug,info,error]("test") will turn on console_output?(i.e. it's equivalent to running Log.open_console_output())

In contrast, the closeAll() function keeps the logger disabled even after a logging.[xyz]() call occurs.

Expand this section to vew a small test script

It is not an expected behavior, and should be fixed with the update.

@zFernand0 zFernand0 merged commit 2eeb8b3 into main Jul 19, 2024
21 checks passed
@zFernand0 zFernand0 deleted the Fix-logger-config branch July 19, 2024 11:08
@zFernand0
Copy link
Member

Thank you for addressing the comment 😋

Copy link

Release succeeded for the main branch. 🎉

The following packages have been published:

  • pypi: zowe-python-sdk-bundle-1.0.0.dev18
  • pypi: zowe_core_for_zowe_sdk-1.0.0.dev18
  • pypi: zowe_zos_console_for_zowe_sdk-1.0.0.dev18
  • pypi: zowe_zos_files_for_zowe_sdk-1.0.0.dev18
  • pypi: zowe_zos_jobs_for_zowe_sdk-1.0.0.dev18
  • pypi: zowe_zos_tso_for_zowe_sdk-1.0.0.dev18
  • pypi: zowe_zosmf_for_zowe_sdk-1.0.0.dev18

Powered by Octorelease 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

Don't modify log level of global logger
3 participants