Pycharm "Save console output to file" not working
I see that no file is saved even though I specify a file pathname log.log in the logs tab (Run/Debug configurations of Pycharm)
1 answer
-
answered 2022-05-06 23:13
omsrisagar
Turns out that the following two boxes should not be checked for this to work:
- Emulate terminal in output console
- Run with Python Console
Uncheck the above two boxes and the logging should work fine. Also remember to specify the log filename instead of directory such as
your_log_directory/log.log
do you know?
how many words do you know
See also questions close to this topic
-
How to search list of numbers in many files
I have 5 files containing numbers and need to search for a list of numbers and print the name of the file it has. i tried this code but don't work
import os out = open('output', 'w') numbers = [23175,2080,6277,6431,19846,10330,25408,25811,8454,10515] filenames = { 'G':'green.txt', 'R':'red.txt', 'B':'blue.txt', 'Y':'yellow.txt', 'O':'orange.txt', } for k,filename in filenames.items(): j=0 with open(filename, 'r') as f: for line in f: if int(line.strip()) == numbers[j]: print(filename) print(numbers[j]) else : j+=1
i got
if int(line.strip()) == numbers[j]: IndexError: list index out of range
-
Validate user input with data in .txt file
I have searched and searched and tried everything. I am creating a game where the user will input a pre-assigned pin and I want to validate that pin against a .txt file in Python. I have tried so many different lines of code and my result is either everything is valid or nothing is valid. What am I doing wrong? The pins are formatted on each line and are alpha numeric like this...
1DJv3Awv5 1DGw2Eql8 3JGl1Hyt7 2FHs4Etz4 3GDn9Buf8 1CEa9Aty0 2AIt9Dxz9 5DFu0Ati4 3AJu9Byi4 1EAm0Cfn1 3BEr0Gwk0 7JAf8Csf8 4HFu0Dlf4
Here is what I have:
user_input = input('Please enter your PIN: ') if user_input in open("PINs.txt").read(): print('Congratulations! Click the button below to get your Bingo Number.') else: print('The PIN you entered does not match our records. Please check your PIN and try again.')
-
Pino-tee logs twice on other logs
References: https://github.com/pinojs/pino-tee
I have two logs, info.log and error.log but the thing is, when I go to info.log, the log for error.log is there
So technically, What I have is :
error.log -> ERROR 1 (W/C correct)
info.log -> ERROR 1, INFO 1 (The error log is there)
What I want is that they go to seperate logs appropriately.
Heres the code from references link above:
const pinoms = require("pino-multi-stream"); const childProcess = require("child_process"); const stream = require("stream"); const cwd = process.cwd(); const { env } = process; const logThrough = new stream.PassThrough(); const prettyStream = pinoms.prettyStream(); const streams = [{ stream: logThrough }, { stream: prettyStream }]; const log = pinoms(pinoms.multistream(streams)); const child = childProcess.spawn( process.execPath, [ require.resolve("pino-tee"), "info", `${__dirname}/info`, "error", `${__dirname}/error`, ], { cwd, env } ); logThrough.pipe(child.stdin); module.exports = log;
Logging test on other file:
const logger = require("./Common/logger"); logger.info("INFO 1"); logger.error("ERROR 1");
Result:
info.log
{"level":30,"time":1651894649071,"pid":19380,"hostname":"","msg":"INFO 1"} {"level":50,"time":1651894649074,"pid":19380,"hostname":"","msg":"ERROR 1"}
error.log
{"level":50,"time":1651894649074,"pid":19380,"hostname":"","msg":"ERROR 1"}
-
Gradle test: println works, logger won't
I'm building a Gradle plugin that does a lot of stuff.
I'm testing it.
I added a lot of logs... None appear.
Yet, if I add
println
statements instead of logs, they do appear.Why? And how do I test "slf4j" is working correctly?
-
Actaully i am working on a project and in it, it is showing no module name pip_internal plz help me for the same. I am using pycharm(conda interpreter
File "C:\Users\pjain\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\pjain\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\pjain\AppData\Local\Programs\Python\Python310\Scripts\pip.exe\__main__.py", line 4, in <module> File "C:\Users\pjain\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\__init__.py", line 4, in <module> from pip_internal.utils import _log
I am using pycharm with conda interpreter.
-
Unused import statement 'import config' Pycharm
class Bot: @staticmethod def token(): telegramtoken = '...' return telegramtoken @staticmethod def executar(): import config # bot configs Bot.executar()
why am i getting this error? if
import config
is working normally? is it possible to remove this warning? -
Programs which accept uppercase and lowercase commands as input
I'm trying to add a help/information box in my program that pops whenever someone type in a /h, /?, /help commands. I want to make sure that my program accepts all characters in both upper and lower case. From what I have, I can check the most frequent cases of these commands, but not all (ie. /HeLp). Looking for way to cover all bases. Here's my current code:
.... bool CheckParseArguments(LPWSTR* argv, int argc) { for (int i = 0; i <= argc; i++) { const wchar_t* help[] = { L"/h", L"/H", L"/?", L"/Help", L"/HELP", L"/help"}; for (int h = 0; h <= 5; h++) if (argc == (i + 1) && wcscmp(argv[i], help[h]) == 0) { MessageBoxW(NULL, L"Correct input is ...", L"Help", MB_OK); return false; } } .... continue with other checks....
-
How to write Scala console output to a XML file?
I'm trying to convert json to xml, I am getting full output in console if the json file is small but I am trying to pass large json file n I'm not getting the entire output in the console
-
c# get html response after script application
I want to have the result of html page but after application of the javascript. If you prefere what i need is to have the html output and not the page code.
Seems not to so easy ?
-
Getting values from Azure DevOps Release Pipeline Task output
I'm new on Azure DevOps, so I'm struggling to solve a basic problem about variables. Hope anyone can give me a hand with it.
Basically, my release pipeline has a job called "Job 1". It has 2 tasks:
Task 1: Deploy a container in an AKS cluster and expose it via an internal LoadBalancer.
steps: - task: Kubernetes@1 displayName: Deployment inputs: connectionType: 'Azure Resource Manager' azureSubscriptionEndpoint: 'MY-SUBSCRIPTION' azureResourceGroup: 'MY-RESOURCEGROUP kubernetesCluster: 'MY-AKS-CLUSTER' namespace: 'MY-NAMESPACE' command: apply useConfigurationFile: true configuration: '$(System.DefaultWorkingDirectory)/_TEST/deployment.yaml'
Note: I checked the option to enable the Output Variables functionality Output Box.
Task 2: Create and configure an API in an API Management, setting that internal LoadBalancer as a backend.
The task 1 gives me the internal LoadBalancer's ipaddress via its output json file. Output json file
I would like to get that ipaddress and use it at Task 2, which runs the following command:
az apim api create --service-name $(apimanagement) -g $(apim-resourcegroup) --api-id $(apiname) --path $(apiname) --display-name $(apiname) --service-url http://_LBIPADDRESS_/openapi.json --subscription-key-required false
My question: How do I make this reference at --service-url parameter?
Any suggestion will be appreciated. Thank you!
Best regards, David