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
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
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
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)
-
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
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
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
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
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
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 =
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
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
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
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
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
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
--
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
I've always wondered that, too. It's the one reason I don't put more
functionality in modules.
I'm using this logging module with logging.conf. It works fine in
controllers models. How to make it work in modules?
Regards,
Joseph
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)
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 =
I have it in a model so it's available everywhere.
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
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(
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
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:
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
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
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 =
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
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
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,
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:
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
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
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
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
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
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
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
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
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
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
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
@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
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
@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.
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
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
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 =
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
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.
52 matches
Mail list logo