Re: [web2py] Re: logging

2017-09-07 Thread Richard Vézina
Hello Lars, Did you read that : https://github.com/web2py/web2py/blob/0d646fa5e7c731cb5c392adf6a885351e77e4903/examples/logging.example.conf I am looking at logging rigth now a new module and I do my research... Setting global logger might be one of the main reason of your issue as I guess you

[web2py] Re: logging

2017-08-31 Thread Lars
The code needs to be in model not in modules. Could anyone explain why ? On Thursday, August 31, 2017 at 12:38:32 PM UTC+2, Lars wrote: > > Hi, > > I have this code in dlogging.py in the modules folder of my app : > > import logging > import logging.handlers > > > def

[web2py] Re: logging exceptions

2015-01-28 Thread Leonel Câmara
In your models you should have something like this: import logging logger = logging.getLogger(web2py.app. + request.application) logger.setLevel(logging.DEBUG) Then you can put logger.exception inside the exception block like so: try: ... exception: logger.exception('got exception') As

[web2py] Re: logging exceptions

2015-01-28 Thread Leonel Câmara
You can use logging.exception('got exception') However, try/exception is generally a bad practice, that catches at any exception at all and can lead to very weird bugs. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

Re: [web2py] Re: logging exceptions

2015-01-28 Thread Vid Ogris
where do I put logging.exception('got exception') and where do I set file path and name? 2015-01-28 13:41 GMT+01:00 Leonel Câmara leonelcam...@gmail.com: You can use logging.exception('got exception') However, try/exception is generally a bad practice, that catches at any exception at all

[web2py] Re: logging into a web2py application from another app by passing username/password

2013-02-17 Thread Massimo Di Pierro
Hello Amber, You do not need to reinvent the wheel for this. Web2py can do it out of the box. Application B. No special code. Just any web2py application that uses Auth and exposes the normal default/user action. Application A. Use decorators like @auth.requires_login() as normal but change

Re: [web2py] Re: logging into a web2py application from another app by passing username/password

2013-02-17 Thread Amber Doctor
Hi Massimo, I'm going to explore this option more. Just a quick question though. It seems like both application A and B need to be web2py. Is that true? Application A isn't a web2py application. Also I learned more about the client's criteria -- they mostly just want a form on application A's

Re: [web2py] Re: logging into a web2py application from another app by passing username/password

2013-02-17 Thread Massimo Di Pierro
Yes I assumed both apps are written in web2py. Yet the protocol it uses is CAS 2.0 therefore that works even if application A is not written in web2py as long as it suports CAS 2.0. Another possibility is, if application A runs under apache, to use the server access control to delegate

Re: [web2py] Re: logging into a web2py application from another app by passing username/password

2013-02-17 Thread Amber Doctor
Thanks I'll explore this route. On Sun, Feb 17, 2013 at 7:14 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Yes I assumed both apps are written in web2py. Yet the protocol it uses is CAS 2.0 therefore that works even if application A is not written in web2py as long as it suports

[web2py] Re: Logging in with applications.

2013-02-04 Thread Vaibhav Kapoor
models/db.py from gluon.tools import Auth,Crud, Service, prettydate from gluon.contrib.login_methods.basic_auth import basic_auth import datetime crud, service = Crud(db), Service(), auth = Auth(db) auth.define_tables(username=True) auth.settings.allow_basic_login = True auth.settings.hmac_key =

[web2py] Re: Logging in with applications.

2013-02-03 Thread encompass
I copied the text from the web2py book online. It should say that they user is then logged in. At least for me it needed to be more descriptive. BR, Jason On Saturday, January 19, 2013 5:22:11 PM UTC+2, Massimo Di Pierro wrote: Where do you read that comment? login_bare does login the user

[web2py] Re: Logging in with applications.

2013-02-03 Thread Anthony
But that text is preceded by: Some times you want to implement your own logic and do manual user login. This can also be done by calling the function: user = auth.login_bare(username,password) To me, that says you can do a manual user login by calling auth.login_bare() (the method name is

[web2py] Re: Logging in with applications.

2013-01-19 Thread Massimo Di Pierro
Where do you read that comment? login_bare does login the user and returns the user record. On Saturday, 19 January 2013 00:31:00 UTC-6, encompass wrote: The last link was the one I was looking at first. Before this post. But login_bare returns user if the user exists and the password is

[web2py] Re: Logging in with applications.

2013-01-18 Thread Alan Etkin
My current app runs with only JSON calls is there a way to make the login occure with JSON? Did you check this? http://www.web2py.com/books/default/chapter/29/10#Services-and-Authentication http://www.web2py.com/books/default/chapter/29/09#Access-Control-and-Basic-Authentication

[web2py] Re: Logging in with applications.

2013-01-18 Thread encompass
The last link was the one I was looking at first. Before this post. But login_bare returns user if the user exists and the password is valid, else it returns False. username is the email if the auth_user table does not have a username field. doesn't sound like I logged in a user. It just

[web2py] Re: Logging user login

2013-01-08 Thread Niphlod
if you dind't change the default settings, you can find already a line for every log-in action into the auth_event table. Il giorno martedì 8 gennaio 2013 12:53:16 UTC+1, Ramos ha scritto: hello how do i log each time a user logs in? thank you António --

Re: [web2py] Re: Logging user login

2013-01-08 Thread António Ramos
great! thk 2013/1/8 Niphlod niph...@gmail.com if you dind't change the default settings, you can find already a line for every log-in action into the auth_event table. Il giorno martedì 8 gennaio 2013 12:53:16 UTC+1, Ramos ha scritto: hello how do i log each time a user logs in? thank

Re: [web2py] Re: Logging in web2py

2012-01-11 Thread pbreit
I've always wondered that, too. It's the one reason I don't put more functionality in modules.

Re: [web2py] Re: Logging in web2py

2012-01-05 Thread Joseph Jude
I'm using this logging module with logging.conf. It works fine in controllers models. How to make it work in modules? Regards, Joseph

[web2py] Re: Logging of user actions

2011-05-20 Thread howesc
in that case i would put it right in the DB, using CRUD's archive tools. then you know who made what changes to what rows and when, and you can go back an restore previous versions. http://web2py.com/book/default/chapter/07?search=archive much easier to parse than text logs (in my opinion)

[web2py] Re: Logging of user actions

2011-05-20 Thread Joseph.Piron
Ah nice trick also, didn't think about the cache, but where do you put the code to defie the _init_log ? On May 19, 11:23 pm, pbreit pbreitenb...@gmail.com wrote: I got this from here awhile back: def _init_log():     import os,logging,logging.handlers,time     logger =

[web2py] Re: Logging of user actions

2011-05-20 Thread pbreit
I have it in a model so it's available everywhere.

[web2py] Re: Logging of user actions

2011-05-19 Thread Joseph.Piron
Oh, the auth.log_event I didn't know.. maybe interesting, but i don't want to log in the db, I need to use my logger config. But I can't possibly believe it's rare to log what users do.. Imagine, I have a db of specifications, I want to know who modified which field at what time.. What should be

[web2py] Re: Logging of user actions

2011-05-19 Thread pbreit
I got this from here awhile back: def _init_log(): import os,logging,logging.handlers,time logger = logging.getLogger(request.application) logger.setLevel(logging.INFO) handler = logging.handlers.RotatingFileHandler(os.path.join(

[web2py] Re: Logging of user actions

2011-05-18 Thread Joseph.Piron
Has noone ever had this king of need ?? On May 17, 11:59 pm, Joseph.Piron joseph.pi...@gmail.com wrote: Hi all, I was wondering what would be the best way to log actions with the username of the logger user. I found several leads but none very conclusive. For example, define a filter in my

[web2py] Re: Logging of user actions

2011-05-18 Thread pbreit
Not sure exactly what you need but, yes, I think it's kind of rare. Maybe this will work for you: by default, Web2py creates an auth_event table and automatically records a bunch of actions like register, login, etc. You can add your own actions with this one-liner:

[web2py] Re: logging time spent in sql statements ?

2011-02-21 Thread NetAdmin
Maybe you could use a trigger on update, insert or delete, but I'm not sure how to do it for a simple select statment. On Feb 21, 4:26 pm, Stef Mientki stef.mien...@gmail.com wrote: hello, is there a way to log the time-duration of all sql statements ? thanks, Stef Mientki

Re: [web2py] Re: logging time spent in sql statements ?

2011-02-21 Thread Martín Mulone
web2py.py -F profiler.log 2011/2/21 NetAdmin mr.netad...@gmail.com Maybe you could use a trigger on update, insert or delete, but I'm not sure how to do it for a simple select statment. On Feb 21, 4:26 pm, Stef Mientki stef.mien...@gmail.com wrote: hello, is there a way to log the

[web2py] Re: logging time spent in sql statements ?

2011-02-21 Thread NetAdmin
You could even do something like this... def makesome(): from gluon.contrib.populate import populate import datetime tstart = datetime.datetime.now().second # insert 2500 random records # YOU MAY WANT TO DO THIS ON A TEST TABLE populate(db.yourtable, 2500) tend =

[web2py] Re: Logging of impersonation events

2010-12-28 Thread alexandremasbr
I used auth.add_permission(user_group_id,'impersonate','auth_user',0), since I want to allow to impersonate any user. On 27 dez, 17:14, mdipierro mdipie...@cs.depaul.edu wrote: Did you auth.add_permission(user_group_id,'impresonate','auth_user',217) ? On Dec 27, 12:51 pm, alexandremasbr

[web2py] Re: Logging of impersonation events

2010-12-27 Thread alexandremasbr
Massimo, I used impersonation in a app, and update to 1.91.4, and it don't work anymore, using the described in the book. How it works now? Alexandre On 8 dez, 05:16, mdipierro mdipie...@cs.depaul.edu wrote: I will add logging. Mind that it has pointed out that impersonate/0 presents a

[web2py] Re: Logging of impersonation events

2010-12-27 Thread alexandremasbr
Massimo, I find the answer, but there is a bug, anyway. The id have to be send by POST, but generates a error caused by a typo in tools.py if requested_id == DEFAULT and not rquest.post_vars: NameError: global name 'rquest' is not defined Please correct it. Alexandre On 27 dez, 15:26,

[web2py] Re: Logging of impersonation events

2010-12-27 Thread mdipierro
fixed in trunk. On Dec 27, 11:43 am, alexandremasbr alexandrema...@gmail.com wrote: Massimo, I find the answer, but there is a bug, anyway. The id have to be send by POST, but generates a error caused by a typo in tools.py     if requested_id == DEFAULT and not rquest.post_vars:

[web2py] Re: Logging of impersonation events

2010-12-27 Thread alexandremasbr
Not working yet. It not recognize the request.post_vars Please, give me a working example. Alexandre On 27 dez, 15:53, mdipierro mdipie...@cs.depaul.edu wrote: fixed in trunk. On Dec 27, 11:43 am, alexandremasbr alexandrema...@gmail.com wrote: Massimo, I find the answer, but there is

[web2py] Re: Logging of impersonation events

2010-12-27 Thread alexandremasbr
Not working yet. It not recognize the request.post_vars Please, give me a working example. I used the form below form action=/app/default/user/impersonate enctype=multipart/form- data method=postSimulate User:input type=submit /div class=hiddeninput name=user_id type=hidden value=217 // div/form

[web2py] Re: Logging of impersonation events

2010-12-27 Thread mdipierro
Did you auth.add_permission(user_group_id,'impresonate','auth_user',217) ? On Dec 27, 12:51 pm, alexandremasbr alexandrema...@gmail.com wrote: Not working yet. It not recognize the request.post_vars Please, give me a working example. I used the form below form

[web2py] Re: Logging of impersonation events

2010-12-10 Thread Markus Schmitz
Hi Massimo, excellent and appreciated. We stumble forward in our quest for the perfect web2py application. Thanks Markus On Dec 8, 9:16 am, mdipierro mdipie...@cs.depaul.edu wrote: I will add logging. Mind that it has pointed out that impersonate/0 presents a mild security risk. We have

[web2py] Re: Logging of impersonation events

2010-12-10 Thread mdipierro
I added the log. Can you please check it? On Dec 8, 1:12 am, Markus Schmitz mschm...@soft-impact.com wrote: Hi everybody, I am working on a new site, where we also plan to use the impersonation feature for support purposes, which is very helpful. The impersonation works perfectly, but it

[web2py] Re: Logging of impersonation events

2010-12-07 Thread mdipierro
I will add logging. Mind that it has pointed out that impersonate/0 presents a mild security risk. We have already changed the impersonate action in trunk and not you have to submit the user_id via POST to impersonate. I am still not 100% happy with this but since it is a security issue we are

[web2py] Re: Logging unsuccessful logins

2010-09-08 Thread mdipierro
In trunk now: auth.settings.login_failed_log = attempted failed login for email=% (email)s On Sep 8, 5:04 am, Kenneth kenneth.t.lundst...@gmail.com wrote: Is there a way to log unseccessful logins, with username, tried password and things like that? I´m having some problems with a couple of

[web2py] Re: Logging in web2py

2010-08-18 Thread Yarin
The reason for named loggers is twofold. One is trivial: to identify the source of log messages. Logging already tracks module, function, lineno... we can even insert a stack trace The other ... to let us have different log levels for different loggers. But it looks like you're introducing

Re: [web2py] Re: Logging in web2py

2010-08-18 Thread Jonathan Lundell
On Aug 18, 2010, at 6:36 AM, Yarin wrote: The reason for named loggers is twofold. One is trivial: to identify the source of log messages. Logging already tracks module, function, lineno... we can even insert a stack trace The other ... to let us have different log levels for different

[web2py] Re: Logging in web2py

2010-08-18 Thread Yarin
Yeah I can dig 'web2py.startup' On Aug 18, 10:17 am, Jonathan Lundell jlund...@pobox.com wrote: On Aug 18, 2010, at 6:36 AM, Yarin wrote: The reason for named loggers is twofold. One is trivial: to identify the source of log messages. Logging already tracks module, function, lineno... we

[web2py] Re: Logging in web2py

2010-08-17 Thread Iceberg
Nice work, Yarin! You use a more decent way, logging.getLogger(request.application), to achive app-wide logger. It is better than my cache.ram() trick. Oh, I was so blind, man. :-) And I wish GAEHandler and get_configured_logger() could go to web2py trunk, and the scaffold's models/model.py

[web2py] Re: Logging in web2py

2010-08-17 Thread Yarin
@Jonathan- Like your use of config files for default configurations, but beyond that I'm not clear on what your patch is meant to solve- What's your reason for introducing named loggers and sub-loggers at the site level? Couldn't the root logger just handle all this? My intention was to use

Re: [web2py] Re: Logging in web2py

2010-08-17 Thread Jonathan Lundell
On Aug 17, 2010, at 9:16 PM, Yarin wrote: @Jonathan- Like your use of config files for default configurations, but beyond that I'm not clear on what your patch is meant to solve- What's your reason for introducing named loggers and sub-loggers at the site level? Couldn't the root logger just

[web2py] Re: Logging in web2py

2010-08-16 Thread Yarin
@Jonathan- I'd like to see what you've got- keep me updated On Aug 16, 5:03 pm, Jonathan Lundell jlund...@pobox.com wrote: On Aug 16, 2010, at 1:31 PM, Yarin wrote: I've posted an updated slice with an in-depth treatment of logging in web2py.

Re: [web2py] Re: Logging in web2py

2010-08-16 Thread Jonathan Lundell
On Aug 16, 2010, at 5:25 PM, Yarin wrote: @Jonathan- I'd like to see what you've got- keep me updated The patch is here, if anyone would like to review it. http://web.me.com/jlundell/filechute/logging.zip Most of the changes are to use a specific logger instead of making a generic logging

[web2py] Re: Logging SQL statements.

2010-03-31 Thread mdipierro
The problem is that sql statemenets can be large and logging them all would blow up the file. The last sql statement is in db._lastsql so you can do a try catch and print (or log) the value of that variable on error. On Mar 31, 7:34 pm, chris_g chrisgu...@gmail.com wrote: Currently, my

[web2py] Re: Logging when files are downloaded from the static directory

2010-01-21 Thread mdipierro
You could check the web server logs in web2py/httpserver.log or the apache logs. You could also implement your own download action: db.define_table('mylog',Field('filename'),Field ('start','datetime'),Field('stop',datetime')) def static(): import datetime path =

[web2py] Re: Logging when files are downloaded from the static directory

2010-01-21 Thread jlegler
Hrm, I've been able to make it detect when the download begins, but determining when it finishes is a horse of a different color. Is the web2py httpserver.log customizable at all? Can I make it log the MAC address or the IP of the machine downloading the file? On Jan 21, 6:02 am, mdipierro

[web2py] Re: Logging when files are downloaded from the static directory

2010-01-21 Thread mdipierro
You have no way of knowing the mac address. It logs the IP already. It always logs 127.0.0.1 if behind a proxy. On Jan 21, 7:13 pm, jlegler jleg...@gmail.com wrote: Hrm, I've been able to make it detect when the download begins, but determining when it finishes is a horse of a different color.