logging

Simple way to perform error logging?

这一生的挚爱 提交于 2019-12-31 08:04:13
问题 I've created a small C# winforms application, as an added feature I was considering adding some form of error logging into it. Anyone have any suggestions for good ways to go about this? This is a feature I've never looked into adding to previous projects, so I'm open to suggestions from Developers who have more experience. I was considering something along the lines of writing exceptions to a specified text file, or possibly a database table. This is an application that will be in use for a

Ofstream creates but wont write to file

天大地大妈咪最大 提交于 2019-12-31 07:34:06
问题 I have wrote some code that does a basic fizzbuzz program to test my logging class, for some reason the data is dumped to the console fine and the file is created fine however the log file is empty whenever I open it. My main is here: int main() { logger* loggerObj = logger::createLogger("log.txt"); for (int i = 1; i <= 100; i++) { loggerObj->createLogEvent(i); if (i == 15) { loggerObj->writeLog(); } } and this is my class: int logger::m_instanceCount = 0; logger* logger::loggerObj = new

How can I display log message in openerp web client?

爷,独闯天下 提交于 2019-12-31 04:12:12
问题 I try to display a message after create a product object that tell user product with product.name is created successful This is the code: def log_prod(self, cr, uid, ids, context=None): product=self.pool.get('product.product').browse(cr, uid, ids) self.log(cr, uid, ids , _("Product %s has been created") % product.name , context=context) return True def create(self, cr, uid, data, context=None): new_id = super(product_product,self).create(cr, uid, data, context) self.log_prod(cr,uid,new_id

How to verify that error was logged with unit tests

こ雲淡風輕ζ 提交于 2019-12-31 03:44:28
问题 Let's say I have the following class like this: public class MyClass { public static final Logger LOG = Logger.getLogger(MyClass.class); public void myMethod(String condition) { if (condition.equals("terrible")) { LOG.error("This is terrible!"); return; } //rest of logic in method } } My unit test for MyClass looks something like this: @Test public void testTerribleCase() throws ModuleException { myMethod("terrible"); //Log should contain "This is terrible!" or assert that error was logged }

Prestashop - how do I write to a log file?

依然范特西╮ 提交于 2019-12-31 03:02:13
问题 What php code should I use in a Prestashop module to write to a log file? I have used Logger::addLog("something",1); but it does not work. 回答1: You can also store the log in file using below code. $logger = new FileLogger(0); //0 == debug level, logDebug() won’t work without this. $logger->setFilename(_PS_ROOT_DIR_.”/log/debug.log”); $logger->logDebug(“message 1″); $logger->logDebug(“message 2″); It will work!. Thanks 回答2: The log is saved in database in 'log' table (with your current prefix)

Spring reading request body twice

别来无恙 提交于 2019-12-31 02:50:33
问题 In spring I have a controller with an endpoint like so: @RequestMapping(method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) @ResponseBody public OutputStuff createStuff(@RequestBody Stuff stuff) { //my logic here } This way if doing a POST on this endpoint, the JSON in request body will be automatically deserialized to my model ( Stuff ). The problem is, I just got a requirement to log the raw JSON as it is coming in! I tried different approaches. Inject HttpServletRequest into

Login to my website in mobile by capturing QR code from the PC browser

☆樱花仙子☆ 提交于 2019-12-31 02:44:11
问题 Is there any technique used to Login to my website, on my mobile, using a qr code from the PC browser ? (The mobile will capture the QR code from pc then open the website and log the user in ... is there any app to store the user authentications and login directly using the QR code?) 回答1: You should have a look at SQRL from Steve Gibson at GRC: https://www.grc.com/sqrl/sqrl.htm This does exactly what you are looking for and best of all, the crypto has been done right. EDIT: Thanks for your

Creating multiple log files in iPhone app

一曲冷凌霜 提交于 2019-12-31 02:13:08
问题 I want to create two log files in my iPhone application. If I redirect the NSLog output to a file using freopen(), then all the log statements will go into one mentioned files. But I want to put some log statements into one file while some into different file. Any idea, how can I do that? 回答1: The best approach would be to write your own logger class as a drop in replacement that you use instead of NSLog(). That way you can easily determine in run-time which logs should be written to which

Custom Runtime node.js - Can't see my custom logs in Google App Engine

北战南征 提交于 2019-12-31 01:36:19
问题 We are using Google App Engine Custom Runtime to run our Node.js Serverside code for our mobile application. HTTP Request logging is working fine, but we are having problems with our custom logs. We are using winston and log4js as logging frameworks to log our application specific loggings to a log file. Running the server locally everything works fine, but the log File cannot be found on the GAE. We did not find a lot about Node.js Logging in the GAE, is there any special configuration

Custom Runtime node.js - Can't see my custom logs in Google App Engine

百般思念 提交于 2019-12-31 01:35:06
问题 We are using Google App Engine Custom Runtime to run our Node.js Serverside code for our mobile application. HTTP Request logging is working fine, but we are having problems with our custom logs. We are using winston and log4js as logging frameworks to log our application specific loggings to a log file. Running the server locally everything works fine, but the log File cannot be found on the GAE. We did not find a lot about Node.js Logging in the GAE, is there any special configuration