logging

Prevent joomla api to log deprecated warning

◇◆丶佛笑我妖孽 提交于 2020-01-25 07:38:04
问题 I have joomla 2.5 which log many deprecated warnings like Error::raiseNotice() is deprecated. So I result width a big log file. Can I turn off this option, and log just my own exceptions? 回答1: You can always place an error reporting condition in your index.php like: error_reporting(E_ALL ^ E_DEPRECATED); For more info: http://php.net/manual/en/function.error-reporting.php Or you can edit error.php in your joomla directory, and public static function raiseNotice($code, $msg, $info = null) { //

Why is caplog.text empty, even though the function I'm testing is logging?

我只是一个虾纸丫 提交于 2020-01-25 06:43:06
问题 I'm trying to use pytest to test if my function is logging the expected text, such as addressed this question (the pyunit equivalent would be assertLogs). Following the pytest logging documentation, I am passing the caplog fixture to the tester. The documentation states: Lastly all the logs sent to the logger during the test run are made available on the fixture in the form of both the logging.LogRecord instances and the final log text. The module I'm testing is: import logging logger =

How to choose the location of a log file for a Java application in a platform independent way?

痞子三分冷 提交于 2020-01-24 22:54:09
问题 I'm writing a java application. Currently this produces a file called "trace.txt" in the same directory the .jar file lives. This can sometimes cause issue with file permissions, eg writing to C:\Program Files\Foo\trace.txt. After a bit of research on SO it seems the general opinion is to log to Application Data\Foo\ for the given user. This won't be the same location for other OS's. What's the best practice in this situation? I'm using java.util.logging. 回答1: You could always use the USER

Logging in GCP and locally

淺唱寂寞╮ 提交于 2020-01-24 19:33:12
问题 I am building a system that is intended to run on Virtual Machines in Google Cloud Platform. However, as a form of backup, it may be run locally as well. That being said, my issue currently is with logging. I have two loggers, both work, a local logger and a cloud logger. Cloud logger import google.cloud.logging from google.cloud.logging.handlers import CloudLoggingHandler from google.oauth2 import service_account CREDS = google.cloud.logging.Client( project=PROJECT, credentials=service

Tomcat log format disable the IPv6 format

无人久伴 提交于 2020-01-24 17:40:08
问题 Here are three log exmaples: 127.0.0.1 - - [17/Sep/2010:14:03:07 +0800] "GET /docs/logging.html HTTP/1.1" 200 24040 "http://localhost:8000/docs/manager-howto.html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)" 0:0:0:0:0:0:0:1 - - [26/Oct/2010:09:53:30 +0800] "GET /docs/images/tomcat.gif HTTP/1.1" 200 1934 "http://localhost:8000/docs/" "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8" 0:0:0:0:0:0:0:1 - - [26/Oct/2010:09

Logging module: too many open file descriptors

旧街凉风 提交于 2020-01-24 12:02:26
问题 I am using Python logging module to print logs to a file, but I encountered the issue that "too many open file descriptors", I did remember to close the log file handlers, but the issue was still there. Below is my code class LogService(object): __instance = None def __init__(self): self.__logger = logging.getLogger('ddd') self.__handler = logging.FileHandler('/var/log/ddd/ddd.log') self.__formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') self.__handler.setFormatter(self.

Logging to Console with DI in C#

放肆的年华 提交于 2020-01-24 11:15:37
问题 in this short sample, if I keep just the .AddConsole() in ConfigureServices nothing gets logged to console regardless of the LogLevel, but if I add .AddConsole().AddDebug() all messages get logged to Console 3 times! What am I missing? Thanks! namespace samples { using System; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; public class Program { public static void Main(string[] args) { var serviceCollection = new ServiceCollection(); ConfigureServices

How to use the logging module in Python with gunicorn

∥☆過路亽.° 提交于 2020-01-24 08:35:08
问题 I have a flask-based app. When I run it locally, I run it from the command line, but when I deploy it, I start it with gunicorn with multiple workers. I want to use the logging module to log to a file. The docs I've found for this are https://docs.python.org/3/library/logging.html and https://docs.python.org/3/howto/logging-cookbook.html . I am confused over the correct way to use logging when my app may be launched with gunicorn. The docs address threading but assume I have control of the

Best practice of log custom exceptions in PHP

╄→гoц情女王★ 提交于 2020-01-24 06:42:40
问题 I have a custom exception (which is further extended in may other custom exceptions). My project requires log all the customExceptions (and all of its decendents) that occurs. I have a logger that can log customException (and anything else). One of the way of doing so is explicitly log the exception whenever it is being handled as follows. try{ //some exception occur } catch(customeException $e) { $log->logException($e); $e->showMessage(); // or do anything that we have to do with the error.

Execute code after Jasmine test failure

两盒软妹~` 提交于 2020-01-24 03:58:25
问题 Is it possible to do something only if a Jasmine test fails? Juxtaposed with afterEach() which executes after an it() regardless of outcome, I'm looking for some way to execute code only after an it() has a failed expectation. This question is not Angular-specific, but in my scenario I am testing an Angular service which outputs debug messages using $log . I don't want to clutter my console for tests that are successful, but only show the additional information for failing tests. describe(