Search Results

Search found 4489 results on 180 pages for 'logging'.

Page 8/180 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Summary count for Python logging

    - by Craig McQueen
    At the end of my Python program, I'd like to be able to get a summary of the number of items logged through the standard logging module. I'd specifically like to be able to get a count for each specified name (and possibly its children). E.g. if I have: input_logger = getLogger('input') input_logger.debug("got input1") input_logger.debug("got input2") input_logger.debug("got input3") network_input_logger = getLogger('input.network') network_input_logger.debug("got network input1") network_input_logger.debug("got network input2") getLogger('output') output_logger.debug("sent output1") Then at the end I'd like to get a summary such as: input: 5 input.network: 2 output: 1 Perhaps by calling a getcount() method for a logger or a handler. What would be a good way to achieve this? I imagine it would involve a sub-class of one of the logging classes, but I'm not sure which one would be best.

    Read the article

  • How to add a custom loglevel to Python's logging facility

    - by tuergeist
    Hi, I'd like to have loglevel TRACE (5) for my application as I don't think that debug() is enought. Additionally log(5, msg) isn't what I want. The question is, how can I add a custom log level to a Python logger? Actually I've a mylogger.py with the following content: import logging @property def log(obj): myLogger = logging.getLogger(obj.__class__.__name__) return myLogger In my code I use it in the following way: class ExampleClass(object): from mylogger import log def __init__(self): '''The constructor with the logger''' self.log.debug("Init runs") Now I'd like to call self.log.trace("foo bar") Thanks in advance for your help.

    Read the article

  • Logging to screen and to a file

    - by robUK
    What design pattern might apply to logging? What is normally used in this type of situation? Any good tutorials? I am writing a client-server application using C89 and gcc 4.4.4. I now need to implement some logging feature that will display log messages on the screen as well as log to a file. However, I don't want to display all log messages (warning, error, critical, unrecoverable, debug, etc). Maybe I can set so that it will display just errors and nothing else. For example, the user might not be interested in the debug messages on the screen output.

    Read the article

  • Sql Server as logging, best connection practise

    - by ozz
    I'm using SqlServer as logging. Yes this is wrong decision, there are better dbs for this requirement. But I have no other option for now. Logging interval is 3 logs per second. So I've static Logger class and it has static Log method. Using "Open Connection" as static member is better for performance. But what is the best implemantation of it? This is not that I know. public static class OzzLogger { static SqlConnection Con; static OzzLogger() { Con=ne SqlConnection(....); Con.Open(); } public static void Log(....) { Con.ExecuteSql(......); } } UPDATE I asked because of my old information. People say "connection pooling performance is enough". If there is no objection I'm closing the issue :)

    Read the article

  • DailyRollingFileHandler ---- Files should be rotated on a daily basis

    - by nag
    We have a requirment which requires to have an Handler that is extended from Java logging and allows to have the files rotated on daily basis. Currently Java util logging do have the support of rotation based on file size by using File Handler. It doesnt support rotation on daily basis. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6350749 Mentioned handler seems is not promising .http://www.x4juli.org/api/org/x4juli/handlers/RollingFileHandler.html So , what we are looking is for such an appender that allows daily rotation . We would like to write such handler and which is the appropriate handler to extend for ... StreamHandler or FileHandler ? And other questions are , is there way we can configure 2 different files for a single handler say FileHandler say for eg , we would like some kind of messages need to be captured in one file and other messages in other file. Would appreciate for any comments.

    Read the article

  • how can i disable the default console handler, while using the java logging api ?

    - by loudiyimo
    Hi I am trying to implement the java logging in my application. I want to use two handlers. A file handler and my own console handler. Both of my handlers work fine. My logging is send to a file and to the console . My logging is also sent to the default console handler, which i do not want. If you run my code you will see extra two line sent to the console. I don't want to use de default console handler. Does anyone know how to disable the default console handler. I only want to use the two hadlers i have created. Handler fh = new FileHandler("test.txt"); fh.setFormatter(formatter); logger.addHandler(fh); Handler ch = new ConsoleHandler(); ch.setFormatter(formatter); logger.addHandler(ch); import java.util.Date; import java.util.logging.ConsoleHandler; import java.util.logging.FileHandler; import java.util.logging.Formatter; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogManager; import java.util.logging.LogRecord; import java.util.logging.Logger; public class LoggingExample { private static Logger logger = Logger.getLogger("test"); static { try { logger.setLevel(Level.INFO); Formatter formatter = new Formatter() { @Override public String format(LogRecord arg0) { StringBuilder b = new StringBuilder(); b.append(new Date()); b.append(" "); b.append(arg0.getSourceClassName()); b.append(" "); b.append(arg0.getSourceMethodName()); b.append(" "); b.append(arg0.getLevel()); b.append(" "); b.append(arg0.getMessage()); b.append(System.getProperty("line.separator")); return b.toString(); } }; Handler fh = new FileHandler("test.txt"); fh.setFormatter(formatter); logger.addHandler(fh); Handler ch = new ConsoleHandler(); ch.setFormatter(formatter); logger.addHandler(ch); LogManager lm = LogManager.getLogManager(); lm.addLogger(logger); } catch (Throwable e) { e.printStackTrace(); } } public static void main(String[] args) { logger.info("why does my test application use the standard console logger ?\n" + " I want only my console handler (Handler ch)\n " + "how can i turn the standard logger to the console off. ??"); } }

    Read the article

  • What are good NoSQL and non-relational database solutions for audit/logging database

    - by Juha Syrjälä
    What would be suitable database for following? I am especially interested about your experiences with non-relational NoSQL systems. Are they any good for this kind of usage, which system you have used and would recommend, or should I go with normal relational database (DB2)? I need to gather audit trail/logging type information from bunch of sources to a centralized server where I could generate reports efficiently and examine what is happening in the system. Typically a audit/logging event would consist always of some mandatory fields, for example globally unique id (some how generated by program that generated this event) timestamp event type (i.e. user logged in, error happened etc) some information about source (server1, server2) Additionally the event could contain 0-N key-value pairs, where value might be up to few kilobytes of text. It must run on Linux server It should work with high amount of data (100GB for example) it should support some kind of efficient full text search It should allow concurrent reading and writing It should be flexible to add new event types and add/remove key-value pairs to new events. Flexible=no changes should be required to database schema, application generating the events can just add new event types/new fields as needed. it should be efficient to make queries against database. For reporting and exploring what happened. For example: How many events with type=X occurred in some time period. Get all events where field A has value Y. Get all events with type X and field A has value 1 and field B is not 2 and event occurred in last 24h

    Read the article

  • Best practices for Java logging from multiple threads?

    - by Jason S
    I want to have a diagnostic log that is produced by several tasks managing data. These tasks may be in multiple threads. Each task needs to write an element (possibly with subelements) to the log; get in and get out quickly. If this were a single-task situation I'd use XMLStreamWriter as it seems like the best match for simplicity/functionality without having to hold a ballooning XML document in memory. But it's not a single-task situation, and I'm not sure how to best make sure this is "threadsafe", where "threadsafe" in this application means that each log element should be written to the log correctly and serially (one after the other and not interleaved in any way). Any suggestions? I have a vague intuition that the way to go is to use a queue of log elements (with each one able to be produced quickly: my application is busy doing real work that's performance-sensitive), and have a separate thread which handles the log elements and sends them to a file so the logging doesn't interrupt the producers. The logging doesn't necessarily have to be XML, but I do want it to be structured and machine-readable. edit: I put "threadsafe" in quotes. Log4j seems to be the obvious choice (new to me but old to the community), why reinvent the wheel...

    Read the article

  • Declare module name of classes for logging

    - by Space_C0wb0y
    I currently am adding some features to our logging-library. One of these is the possibility to declare a module-name for a class that automatically gets preprended to any log-messages writing from within that class. However, if no module-name is provided, nothing is prepended. Currently I am using a trait-class that has a static function that returns the name. template< class T > struct ModuleNameTrait { static std::string Value() { return ""; } }; template< > struct ModuleNameTrait< Foo > { static std::string Value() { return "Foo"; } }; This class can be defined using a helper-macro. The drawback is, that the module-name has to be declared outside of the class. I would like this to be possible within the class. Also, I want to be able to remove all logging-code using a preprocessor directive. I know that using SFINAE one can check if a template argument has a certain member, but since other people, that are not as friendly with templates as I am, will have to maintain the code, I am looking for a much simpler solution. If there is none, I will stick with the traits approach. Thanks in advance!

    Read the article

  • Logging in "Java Library Code" libs for Android applications

    - by K. Claszen
    I follow the advice to implement Android device (not application!) independent library code for my Android Apps in a seperate "Java Library Code" project. This makes testing easier for me as I can use the standard maven project layout, Spring test support and Continuous Build systems the way I am used to. I do not want to mix this inside my Android App project although this might be possible. I now wonder how to implement logging in this library. As this library will be used on the Android device I would like to go with android.util.Log. I added the followind dependency to my project to get the missing Android packages/classes and dependencies: <dependency> <groupId>com.google.android</groupId> <artifactId>android</artifactId> <version>2.2.1</version> <scope>provided</scope> </dependency> But this library just contains stub method (similar to the android.jar inside the android-sdk), thus using android.util.Log results in java.lang.RuntimeException: Stub! when running my unit tests. How do I implement logging which works on the Android device but does not fail outside (I do not expect it to work, but it must not fail)? Thanks for any advice Klaus For now I am going with the workaround to catch the exception outside android but hope there is a better solution. try { Log.d("me", "hello"); } catch (RuntimeException re) { // ignore failure outside android }

    Read the article

  • implementing user tracking (logging) in Rails 3

    - by seth.vargo
    Hi, I'm creating a Rails application in which logging individual user actions is vital. Every time a user clicks a url, I want to log the action along with all parameters. Here is my current implementation: class CreateActivityLogs < ActiveRecord::Migration create_table :activity_logs do |t| t.references :user t.string :ip_address t.string :referring_url t.string :current_url t.text :params t.text :action t.timestamps end end   class ActivityLog < ActiveRecord::Base belongs_to :user end In a controller, I'd like to be able to do something like the following: ... ActivityLog::log @user.id, params, 'did foo with bar' ... I'd like to have the ActivityLog::log method automatically get the IP address, referring url, and current url (I know how to do this already) and create a new record in the table. So, my questions are: How do I do this? How do I use ActivityLog without having to create an instance everytime I want to log? Is this the best way? Some people have argued for a flat-file log for this kind of logging - however, I want admins to be able to see a user's activity in the backend as well, so I thought a database solution may be better?

    Read the article

  • realtime logging

    - by Ion Todirel
    I have an application which has a loop, part of a "Scheduler", which runs at all time and is the heart of the application. Pretty much like a game loop, just that my application is a WPF application and it's not a game. Naturally the application does logging at many points, but the Scheduler does some sensitive monitoring, and sometimes it's impossible just from the logs to tell what may have gotten wrong (and by wrong I don't mean exceptions) or the current status. Because Scheduler's inner loop runs at short intervals, you can't do file I/O-based logging (or using the Event Viewer) in there. First, you need to watch it in real-time, and secondly the log file would grow in size very fast. So I was thinking of ways to show this data to the user in the realtime, some things I considered: Display the data in realtime in the UI Use AllocConsole/WriteConsole to display this information in a console Use a different console application which would display this information, communicate between the Scheduler and the console app using pipes or other IPC techniques Use Windows' Performance Monitor and somehow feed it with this information ETW Displaying in the UI would have its issues. First it doesn't integrate with the UI I had in mind for my application, and I don't want to complicate the UI just for this. This diagnostics would only happen rarely. Secondly, there is going to be some non-trivial data protection, as the Scheduler has it's own thread. A separate console window would work probably, but I'm still worried if it's not too much threshold. Allocating my own console, as this is a windows app, would probably be better than a different console application (3), as I don't need to worry about IPC communication, and non-blocking communication. However a user could close the console I allocated, and it would be problematic in that case. With a separate process you don't have to worry about it. Assuming there is an API for Performance Monitor, it wouldn't be integrated too well with my app or apparent to the users. Using ETW also doesn't solve anything, just a random idea, I still need to display this information somehow. What others think, would there be other ways I missed?

    Read the article

  • Logging errors in SCSF

    - by WF
    I'm quite new to SCSF. So, I'm developping a SCSF Winforms in C# (using May 2007 version in VSNet 2005 Fwk2.0, I can't use new version). I've implemented a Business module. What is the best practise to log errors? I've configured the Logging Application Block. But how to use that ? Thanks for answers

    Read the article

  • is there in R any standard logging package?

    - by mariotomo
    not only is googling R so terribly difficult, log4r has also been taken for Ruby! I am looking for the standard (if any) logging package for R. and some sample usage? I also don't see it in http://cran.r-project.org/web/packages/ (late edit: it is now at its place on CRAN and there's a R-Forge page for it.)

    Read the article

  • Logging and Error handling in asp.net

    - by parminder
    Hi Experts, I have a website running now. I have to implement some logging routines as well as some handler for unhandeled exceptions. I was looking at ELMAH also which seems good to me. I need something very light and easy to use. Can someone recommend any other option I can choose from. Thanks Parminder

    Read the article

  • Glassfish v3 logging

    - by George Liolios
    How to in Glassfish v3 can use stdout and stderr in Primary Key class the glassfish server log ($GF_HOME/domains/domain1/logs/server.log).Is there a setting that has to be turned or do applications now have to support their own logging?

    Read the article

  • Implementing a logging library in .NET with a database as the storage medium

    - by Dave
    I'm just starting to work on a logging library that everyone can use to keep track of any sort of system information while the user is running our application. The simplest example so far is to track Info, Warnings, and Errors. I want all plugins to be able to use this feature, but since each developer might have a different idea of what's important to report, I want to keep this as generic as possible. In the C++ world, I would normally use something like a stl::pair<string,string> to act as a key value pair structure, and have a stl::list of these to act as a "row" in the log. The log cache would then be a list<list<pair<string,string>>> (ugh!). This way, the developers can use a const string key like INFO, WARNING, ERROR to have a consistent naming for a column in the database (for SELECTing specific types of information). I'd like the database to be able to deal with any number of distinct column names. For example, John might have an INFO row with a column called USER, and Bill might have an INFO row with a column called FILENAME. I want the log viewer to be able to display all information, and if one report doesn't have a value for INFO / FILENAME, those fields should just appear blank. So one option is to use List<List<KeyValuePair<String,String>>, and the another is to have the log library consumer somehow "register" its schema, and then have the database do an ALTER TABLE to handle this situation. Yet another idea is to have a table that's just for key value pairs, with a foreign key that maps the key value pairs back to the original log entry. I obviously don't want logging to bog down the system, so I only lock the log cache to make a copy of the data (and remove the already-copied data), then a background thread will dump the information to the database. My specific questions regarding this are: Do you see any performance issues? In other words, have you ever tried something like this and found that certain things just don't work well in practice? Is there a more .NETish way to implement the key value pairs, other than List<List<KeyValuePair<String,String>>>? Even if there is a way to do #2 better, is the ALTER TABLE idea I proposed above a Bad Thing? Would you recommend multiple databases over a single one? I don't yet have an idea of how frequently the log would get written to, but we ideally would like to have lots of low level information. Perhaps there should be a DB with a fixed schema only for the low level stuff, and then another DB that's more flexible for reporting information back to users.

    Read the article

  • Logging to TextFile from SharePoint

    - by Swami
    I'm trying to debug a webpart installed on a client's SharePoint instance. I wanted a quick and easy logging feature, so I thought of writing messages to a text file in the temp directory. SharePoint doesn't seem to like it, so what are my options?

    Read the article

  • Logging in a C# library

    - by koumides
    All, I wonder what is the best practise regarding logging inside a library. I am creating a C# library to be used by users and at some points I want to log an error or a warning. Is it a good practice to use log4net and log in a file? Thanks, M

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >