SP Error handler logging errors

Discussion in 'MySQL' started by MatthewBaynham, Apr 20, 2020.

  1. #1
    I'm trying to write an error handler which will insert any errors into a log table so that I can log them and look at them later.

    The reason I want to use my own table to log errors is I can add additional information for example which line of a source file crashes my log procedure.

    I know that "DECLARE EXIT handler for sqlexception" will catch the error.

    I've read about "Show Errors;"

    But how to I do an "insert into MyErrorLogTable (....) show errors", so that I put the errors into a log table?
     
    MatthewBaynham, Apr 20, 2020 IP
  2. SpacePhoenix

    SpacePhoenix Well-Known Member

    Messages:
    197
    Likes Received:
    28
    Best Answers:
    2
    Trophy Points:
    155
    #2
    Just MySQL errors only? What server-side language is being used?
     
    SpacePhoenix, Apr 20, 2020 IP
  3. MatthewBaynham

    MatthewBaynham Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    My original question refers to stored procedures on an MySQL server.
     
    MatthewBaynham, Apr 22, 2020 IP