更改控制器中的任何内容时出错

时间:2018-10-25 04:37:34

标签: grails intellij-idea

我正在使用grails 2.5.1并且我的IDE是IntelliJ,当我更改控制器中的任何内容时,我在控制台中收到以下错误,并且一直发生直到我重新启动grails为止,无论如何是吗?

spi.SqlExceptionHelper , [Thread-11] Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:100; busy:10; idle:0; lastwait:30000].

我有一个控制器登录到数据库,这里是:

class EventLogAppender   extends org.apache.log4j.AppenderSkeleton
implements org.apache.log4j.Appender{

static appInitialized = false

String source

@Override
protected void append(LoggingEvent event) {
    if (appInitialized) {
        //copied from Log4J's JDBCAppender
        event.getNDC();
        event.getThreadName();
        // Get a copy of this thread's MDC.
        event.getMDCCopy();
        event.getLocationInformation();
        event.getRenderedMessage();
        event.getThrowableStrRep();

        def limit = { string, maxLength -> string.substring(0, Math.min(string.length(), maxLength))}

        String logStatement = getLayout().format(event);
        // use new transaction so that the log entry will be written even if the currently running transaction is rolled back
        EventLog.withNewTransaction {
            EventLog eventLog = new EventLog()
            eventLog.message = "Log4 Error Log"
            eventLog.details = limit((logStatement ?: "Not details available, something is wrong"), EventLog.DETAILS_MAXSIZE)
            eventLog.source = limit(source ?: "Source not set", EventLog.SOURCE_MAXSIZE)
            eventLog.save()
        }
    }
}

/**
 * Set the source value for the logger (e.g. which application the logger belongs to)
 * @param source
 */
public void setSource(String source) {
    this.source = source
}

@Override
void close() {
    //noop
}

@Override
boolean requiresLayout() {
    return true
}

}

0 个答案:

没有答案