Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement](fe exception) write a java annotation to catch throwable from a method and print log #17797

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
83a46b7
add java annotation to catch throwable from a method and print log
Mar 8, 2023
879bf22
add java annotation to catch throwable from a method and print log
Mar 8, 2023
1e03d61
add java annotation to catch throwable from a method and print log
Mar 8, 2023
140d62e
add java annotation to catch throwable from a method and print log
Mar 8, 2023
e2e8696
Merge branch 'apache:master' into kongxuan.yao/Feature/add_exception_…
NetShrimp06 Mar 9, 2023
be73232
add java annotation to catch throwable from a method and print log
Mar 9, 2023
07cd501
Merge branch 'apache:master' into kongxuan.yao/Feature/add_exception_…
NetShrimp06 Mar 9, 2023
a1c4a47
add java annotation to catch throwable from a method and print log
Mar 9, 2023
7847925
Merge remote-tracking branch 'origin/kongxuan.yao/Feature/add_excepti…
Mar 9, 2023
7ee4913
add java annotation to catch throwable from a method and print log
Mar 10, 2023
81df920
Merge branch 'master' into kongxuan.yao/Feature/add_exception_log_ann…
Mar 14, 2023
a7e3cfe
add java annotation to catch throwable from a method and print log
Mar 14, 2023
dda56ba
add java annotation to catch throwable from a method and print log
Mar 14, 2023
1da3308
add java annotation to catch throwable from a method and print log
Mar 15, 2023
7389ae3
add java annotation to catch throwable from a method and print log
Mar 15, 2023
900e1c2
add java annotation to catch throwable from a method and print log
Mar 16, 2023
4c776a3
add java annotation to catch throwable from a method and print log
Mar 16, 2023
c47be56
add java annotation to catch throwable from a method and print log
Mar 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add java annotation to catch throwable from a method and print log
  • Loading branch information
kongxuan.yao committed Mar 16, 2023
commit 4c776a340df070bbacfdca980131bd0b21b2b155
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
// You can use this annotation when you want add try catch logger error.
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ExceptionLog {
public @interface LogException {
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public void exitPointCut() {

@AfterThrowing(value = "exitPointCut()", throwing = "e")
public void exit(Throwable e) {
LOG.error("A problem that does not allow errors has occurred.");
LOG.error(e.getMessage());
LOG.warn("A problem that does not allow errors has occurred.");
LOG.warn(e);
System.exit(-1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public class LogAspect {

private static final Logger LOG = LogManager.getLogger(LogAspect.class);

@Pointcut("@annotation(org.apache.doris.common.annotation.ExceptionLog)")
@Pointcut("@annotation(org.apache.doris.common.annotation.LogException)")
public void throwingLogPointCut() {
}

@AfterThrowing(value = "throwingLogPointCut()", throwing = "e")
public void exceptionLog(Throwable e) {
LOG.warn(e.getMessage());
public void logException(Throwable e) {
LOG.warn(e);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.apache.doris.common.DdlException;
import org.apache.doris.common.FeMetaVersion;
import org.apache.doris.common.MetaNotFoundException;
import org.apache.doris.common.annotation.ExceptionLog;
import org.apache.doris.common.annotation.LogException;
import org.apache.doris.common.io.Text;
import org.apache.doris.common.util.DebugUtil;
import org.apache.doris.common.util.LogBuilder;
Expand Down Expand Up @@ -182,7 +182,7 @@ public Set<String> getTableNamesForShow() {
.collect(Collectors.toSet());
}

@ExceptionLog
@LogException
@Override
public Set<String> getTableNames() throws MetaNotFoundException {
Set<String> result = Sets.newHashSet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.doris.catalog.Table;
import org.apache.doris.catalog.TableIf;
import org.apache.doris.common.MetaNotFoundException;
import org.apache.doris.common.annotation.ExceptionLog;
import org.apache.doris.common.annotation.LogException;
import org.apache.doris.load.EtlJobType;
import org.apache.doris.load.FailMsg;
import org.apache.doris.load.FailMsg.CancelType;
Expand Down Expand Up @@ -85,7 +85,7 @@ public Set<String> getTableNamesForShow() {
return Sets.newHashSet(name);
}

@ExceptionLog
@LogException
@Override
public Set<String> getTableNames() throws MetaNotFoundException {
Database database = Env.getCurrentInternalCatalog().getDbOrMetaException(dbId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import org.apache.doris.common.ThriftServerEventProcessor;
import org.apache.doris.common.UserException;
import org.apache.doris.common.Version;
import org.apache.doris.common.annotation.ExceptionLog;
import org.apache.doris.common.annotation.LogException;
import org.apache.doris.common.util.TimeUtils;
import org.apache.doris.cooldown.CooldownDelete;
import org.apache.doris.datasource.CatalogIf;
Expand Down Expand Up @@ -496,7 +496,7 @@ public int getAsInt() {
return result;
}

@ExceptionLog
@LogException
@Override
public TGetTablesResult getTableNames(TGetTablesParams params) throws TException {
LOG.debug("get table name request: {}", params);
Expand Down