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 a
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 get_configured_logger(name
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')
A
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 :
> 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
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)
- h
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 suport
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 authenti
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
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
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 =
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 k
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
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 passw
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.
>
> 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
http://
great!
thk
2013/1/8 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
>>
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
>
--
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
I have it in a model so it's available everywhere.
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 wrote:
> I got this from here awhile back:
>
> def _init_log():
> import os,logging,logging.handlers,time
> logger = logging.getLogger(request.application)
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)
c
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(
request.folder,'logs','applog.log'),'a',1
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 t
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:
auth.log_event(description='t
Has noone ever had this king of need ??
On May 17, 11:59 pm, "Joseph.Piron" 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 model:
>
> im
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.py -F profiler.log
2011/2/21 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 wrote:
> > hello,
> >
> > is there a way to log the time-duration of all sql statement
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 wrote:
> hello,
>
> is there a way to log the time-duration of all sql statements ?
>
> thanks,
> Stef Mientki
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 wrote:
> Did you
>
> auth.add_permission(user_group_id,'impresonate','auth_user',217)
>
> ?
>
> On Dec 27, 12:51 pm, alexandremasbr wrote:
>
> > No
Did you
auth.add_permission(user_group_id,'impresonate','auth_user',217)
?
On Dec 27, 12:51 pm, alexandremasbr wrote:
> Not working yet. It not recognize the request.post_vars
> Please, give me a working example.
>
> I used the form below
> Simulate User: class="hidden"> div>
>
> Alexandre
>
>
Not working yet. It not recognize the request.post_vars
Please, give me a working example.
I used the form below
Simulate User:
Alexandre
On 27 dez, 16:46, alexandremasbr wrote:
> Not working yet. It not recognize the request.post_vars
>
> Please, give me a working example.
>
> Alexandre
>
> O
Not working yet. It not recognize the request.post_vars
Please, give me a working example.
Alexandre
On 27 dez, 15:53, mdipierro wrote:
> fixed in trunk.
>
> On Dec 27, 11:43 am, alexandremasbr wrote:
>
>
>
> > Massimo,
>
> > I find the answer, but there is a bug, anyway.
>
> > The id have to
fixed in trunk.
On Dec 27, 11:43 am, alexandremasbr 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:
> NameError: global name '
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, a
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 wrote:
> I will add logging.
>
> Mind that it has pointed out that impersonate/0 presents a mild
> security risk. We
I added the log. Can you please check it?
On Dec 8, 1:12 am, Markus Schmitz 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 looks like there is no
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 wrote:
> I will add logging.
>
> Mind that it has pointed out that impersonate/0 presents a mild
> security risk. We have already changed the im
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 br
In trunk now:
auth.settings.login_failed_log = "attempted failed login for email=%
(email)s"
On Sep 8, 5:04 am, Kenneth 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 users not been able to
Yeah I can dig 'web2py.startup'
On Aug 18, 10:17 am, Jonathan Lundell 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 can even
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 differe
> 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 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 j
@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 named
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 co
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 ca
@Jonathan- I'd like to see what you've got- keep me updated
On Aug 16, 5:03 pm, Jonathan Lundell 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.
> >http://web2pyslices.com/main/slices/take_slice/91
>
>
Thanks, that worked.
I made this change to gluons/tools.py until I captured the error.
def insert(self, **fields):
query = self._insert(**fields)
self._db['_lastsql'] = query
* logging.error('insert:\n%s'%query)
...
On Apr 1, 12:55 pm, mdipierro wrote:
> The las
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 wrote:
> Currently, my sql.log contains the DAL g
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 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. Is the
> web2py
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 wrot
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 = os.path.join(request.fold
53 matches
Mail list logo