logging

How to save Heroku logs to text file

烂漫一生 提交于 2019-12-31 00:59:28
问题 I am having a problem with logs in Heroku. When I want to look at the logs, sometimes I have missed a few lines. How can I save Heroku server logs to file.txt, or any other file? 回答1: You can try this: heroku logs -n number_of_lines --app application_name >> file_name >> operator will appends the command output to the end of a file : file_name however, heroku keeps the last 1,500 lines of consolidated logs. If you’d like to persist more than 1,500 lines for long-term storage, search, alerting

Suppress java util logging from 3rd party jar

佐手、 提交于 2019-12-30 15:01:03
问题 I am getting tons of info log messages from a 3rd party jar in my eclipse console. Cracking open the jar I see that it uses java.util.logging. I would like to set the output level for their jar to WARNING. I have tried using the VM argument of -Djava.util.logging.config.file=pathToMy/JUL.properties where the contents of the file are: handlers=java.util.logging.ConsoleHandler .level=WARNING java.util.logging.ConsoleHandler.level=WARNING Unfortunately, that made no difference in the output. If

How to login to HTML form using POST vars in C# (.NET)?

ⅰ亾dé卋堺 提交于 2019-12-30 11:26:31
问题 For example, there is this website: www.azet.sk On the right, there is login and password, I'd like my application to login to this web application and retrieve the data from my own account to C# (.NET) application and work with it. The aim is to keep the "logged in" connection alive and send vars using POST method. Is there any tutorial or easy script with examples to learn this? 回答1: string username = "your"; string password = "password"; HttpWebRequest request = (HttpWebRequest)WebRequest

Converting log4j.properties to log4j.xml [duplicate]

馋奶兔 提交于 2019-12-30 10:43:29
问题 This question already has answers here : Script to convert log4j.properties to log4j.xml (4 answers) Closed 5 years ago . I couldn't find anywhere how to specify constants in log4j.xml. For example, I have this constant in my log4j.properties: #Log directory dal.log.dir=/var/log/pojodal/ # Log filename dal.log.file=pojodal.log And I use these constants as follows, in other parts of the properties file: log4j.appender.DRFA1.File=${dal.log.dir}/${dal.log.file} How to achieve the same behavior

How can I set up separate streams of logging for log4j?

拜拜、爱过 提交于 2019-12-30 09:51:41
问题 Say I have a class like this: public class MyClass { private Logger log = LoggerFactory.getLogger(MyClass.class); //org.slf4j.LoggerFactory public void foo(Params p) { log.info("Foo params: " + p); long t1 = System.currentTimeMillis(); Result r = someMethod(p); long t2 = System.currentTimeMillis(); log.info("Foo result: " + r) log.info("Foo time taken: + (t2-t1)/1000); } } Now when it comes to printing this info, I want to be able to turn on and off the different types of info (Parameters,

Python logging module having a formatter causes AttributeError

家住魔仙堡 提交于 2019-12-30 09:00:40
问题 I am writing a terminal application, which, after passing in -v option, gets, unsurprisingly, verbose. I want to have the output available in the terminal, for easy testing (it gets redirected to a log file when running as cron anyways). However, python logging module doesn't allow me to write out the messages with corresponding levels when using a formatter. (Formatter is copied directly from Python Logging Cookbok) This behavior is not limited to Python3 only. Python2.7 raises the same

How can I configure Jenkins to show my logs in the workspace?

限于喜欢 提交于 2019-12-30 08:09:22
问题 I am using Jenkins for CI - and want to be able to expose the logs so we don't have to telnet onto the CI box to see what's going on. Is there a plugin that will do this? Or should I just need to write a script? 回答1: My answer is about reading application server/container log files from different boxes than Jenkins is running on. For example, if you use Jenkins to build your wars and then deploy them to several environments and you want to read the log files from your Jenkins CI server

How can I configure Jenkins to show my logs in the workspace?

你。 提交于 2019-12-30 08:09:01
问题 I am using Jenkins for CI - and want to be able to expose the logs so we don't have to telnet onto the CI box to see what's going on. Is there a plugin that will do this? Or should I just need to write a script? 回答1: My answer is about reading application server/container log files from different boxes than Jenkins is running on. For example, if you use Jenkins to build your wars and then deploy them to several environments and you want to read the log files from your Jenkins CI server

How to add a custom log level to logger in ruby?

回眸只為那壹抹淺笑 提交于 2019-12-30 08:07:09
问题 I need to add a custom log level like "verbose" or "traffic" to ruby logger, how to do? 回答1: Your own logger just need to overwrite the Logger#format_severity method, something like this : class MyLogger < Logger SEVS = %w(DEBUG INFO WARN ERROR FATAL VERBOSE TRAFFIC) def format_severity(severity) SEVS[severity] || 'ANY' end def verbose(progname = nil, &block) add(5, nil, progname, &block) end end 回答2: You can simply add to the Logger class: require 'logger' class Logger def self.custom_level

python logging root logger does not show info even if I set the level to INFO

僤鯓⒐⒋嵵緔 提交于 2019-12-30 07:56:21
问题 I created the following script. Could any of you explain to me why the output is like what shows below Source import logging logger = logging.getLogger() logger.setLevel(logging.DEBUG) print('debug', logger.isEnabledFor(logging.DEBUG)) print('info', logger.isEnabledFor(logging.INFO)) print('warning', logger.isEnabledFor(logging.WARNING)) print('error', logger.isEnabledFor(logging.ERROR)) logger.debug('debug') logger.info('info') logger.warning('warning') logger.error('error') logging.debug(