You can see error tickets from the Admin module (screenshot below). I
believe they are stored on the filesystem, not in a table. I have never
looked.

Re Flash messages, unless they are generated from error tickets, i doubt
they are stored anywhere.

I have a function that logs errors (and anything else I want) in an
EventLog table. You are probably catching all errors and trying to handle
them gracefully so its not hard to grab the error that was raised at that
point. Trying to extract the error from the exception took me a little
looking for. My code for that is below.

Also, there is a logging feature in web2py.
http://web2py.com/books/default/chapter/29/04/the-core?search=logger#Logging


Maybe something there helps?

[image: image.png]

def MyFunction:
try:
#My code

    except Exception as e:
        Result = Public.LogError(pyFileName, e, I, ReturnJson = False)


Public Module
-------------
from datetime import datetime
import inspect
import sys
import simplejson as json

def LogError(FileName, e=None, ExtraInfo = "", LogType = 'Error',
ReturnJson=False, FlashError = False):

    NOW = datetime.now()
    curframe = inspect.currentframe()
    ErrFunction = inspect.getouterframes(curframe, 2)
    Msg = sys.exc_info()[0]
    LogFunction = "%s < %s < %s [%s]" %(ErrFunction[1].function,
ErrFunction[2].function, ErrFunction[3].function, FileName)

    if e:
        if hasattr(e, 'message'):
            Msg = "%s [Sys: %s]" % (e.message, Msg)
            #print(e.message)
        else:
            #print(e)
            Msg = "%s [Sys: %s]" % (e, Msg)

    if not Msg: Msg=''

    print('------------------------------- ERROR
-----------------------------------')
    print("%s: FUNC: %s. ERR: %s. %s" % (str(NOW)[11:19], LogFunction, Msg,
ExtraInfo))
    Common.AddLogEntry(LogType=LogType, LogFunction = LogFunction,
LogMessage = '%s %s' % (Msg, ExtraInfo))


print('-------------------------------------------------------------------------')

    result = ("%s: FUNC: %s. ERR: %s. %s" % (str(NOW)[11:19], LogFunction,
Msg, ExtraInfo))

    message = result
    if 'ERR: UNIQUE constraint failed' in message:
        startat = message.find("ERR: UNIQUE")
        char1 = ":"
        char2 = "["
        table_info = message[message.find(char1,startat) + 1:
message.find(char2,startat)]
        message = f'There is already a record in the database just like
this one. We cannot add another. ({table_info})'

    if FlashError: current.response.flash = XML("Error: " + message +
current.response.flash)

    result = dict(Success = False, Message = message)
    if ReturnJson:
        result = json.dumps(result)

    logger = logging.getLogger("web2py.app.myapp")
    logger.setLevel(logging.DEBUG)
    logger.error(message)

    return result


___________________________
*www.TenOutOfTen.org* <https://www.TenOutOfTen.org>
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)




On Mon, 16 Nov 2020 at 20:49, Brennie Standy <brenniesta...@gmail.com>
wrote:

> I have a ticket where our client wishes to see a list of all
> flash/alert/error messages, including anything from "Logged in" to our own
> customized error messages set by the previous developer. Where in the app
> can I find this list? Standard global search is not proving useful. Thanks!
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/b447d3c3-987d-4d59-a790-2dacf04f2fe6n%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/b447d3c3-987d-4d59-a790-2dacf04f2fe6n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPttp_K25bZR9XNau25TsS9HaOiJOSQoyfXZJdqgN9kpw%40mail.gmail.com.

Reply via email to