Home > Back-end >  Java how to prohibit throw an exception information?
Java how to prohibit throw an exception information?

Time:11-22

The following exception is due to the fact that a database table is empty (no data), there isn't much meaning in this exception is thrown, I hope it not selling, direct ignore and continue running, it took me a try, but still in the console throws an exception information, an eyesore, how to don't show the abnormal information?

CodePudding user response:

From the log is com. Alibaba. Druid. Pool. DruidDataSource output log,
If do not want it to output log, can in application. Add the following configuration in the yml, only output error log:
Logging:
Level:
Com. Alibaba. Druid. Pool. DruidDataSource: ERROR

CodePudding user response:

Step in to see where the printStackTrace (), and then delete the can,

CodePudding user response:

reference 1st floor water 2 reply:
from the log is com. Alibaba. Druid. Pool. DruidDataSource output log,
If do not want it to output log, can in application. Add the following configuration in the yml, only output error log:
Logging:
Level:
Com. Alibaba. Druid. Pool. DruidDataSource: ERROR
already according to your Settings, or no, can you don't even output ERROR log?

CodePudding user response:

The stack is printed in your getPracticeData function, not your printed here, you have to press the upstairs said, traced function inside see,

CodePudding user response:

cited the 4th floor old zizhu reply:
stack is printed in your getPracticeData function, not your printed here, you have to press the upstairs said, traced function inside see,
getPracticeData have seen, all the catch didn't write the output, not just getPracticeData, there are other places so also is a interface (below), feel these things is mybatis printed, don't want to change mybatis source? Mybatis is there any way to ban it output exception information?

CodePudding user response:

Sorry, abstract methods in the interface section is wrong, is not the case, but does not affect the discussion, is another of the same interface abstraction method, don't cut, anyway,

CodePudding user response:

The Exception is not the highest level of
If you really want to capture all, then you can try
The catch (Throwable e)

CodePudding user response:

refer to 7th floor sunyiz response:
Exception is not the highest
If you really want to capture all, then you can try
The catch (Throwable e)
no

CodePudding user response:

refer to the eighth floor lgxysl response:
not


This means that you try to perform the method within the exception capture
And do the abnormal output

CodePudding user response:

reference lgxysl reply: 3/f
Quote: refer to 1st floor water 2 reply:
from the log is com. Alibaba. Druid. Pool. DruidDataSource output log,
If do not want it to output log, can in application. Add the following configuration in the yml, only output error log:
Logging:
Level:
Com. Alibaba. Druid. Pool. DruidDataSource: ERROR
already according to your Settings, or no, can you don't even output ERROR log?


Methods all tell you, why don't you continue to search for the method? Or go to the website to see?
You are so bad for growth,

ERROR is only output ERROR log,
Log OFF is closed,

CodePudding user response:

Change log level is not the solution, unless you want the system don't need all error log;

This is what you call API have try operation inside, you need this kind of situation in your own code to judge, and then get rid of, like a null pointer, after you decide is null, the initial value to it, or don't call the API

CodePudding user response:

references to the tenth floor water 2 reply:
Quote: refer to the third floor lgxysl response:
Quote: refer to 1st floor water 2 reply:
from the log is com. Alibaba. Druid. Pool. DruidDataSource output log,
If do not want it to output log, can in application. Add the following configuration in the yml, only output error log:
Logging:
Level:
Com. Alibaba. Druid. Pool. DruidDataSource: ERROR
already according to your Settings, or no, can you don't even output ERROR log?


Methods all tell you, why don't you continue to search for the method? Or go to the website to see?
You are so bad for growth,

ERROR is only output ERROR log,
OFF is closed, the log
still no,

CodePudding user response:

Throw your project onto gitlab or gitee, I'm free
  • Related