Java: Only log first error occurrence (with hourly reset)
Your code currently checks when the last error occurred. This might not be what you actually want. Assuming that an error occurs every 30 minutes, I would expect to have a log entry every 60 minutes. Your current code produces one log entry at the beginning, and no more log entries after that.

I once wrote similar code, and I separated the code into two Java classes: the Throttler for the actual algorithm and the ThrottledLogger for using the algorithm to throttle log messages.

I'm still happy with that old code, and it had the following additional features:


It allows several events before throttling kicks in.
When throttling kicks in, that is logged as well ("further log messages will be suppressed").
When throttling has finished, that is logged as well ("suppressed {} messages").


With these changes, the log messages do not hide any important information. The throttled logger I used was created like this:

new ThrottledLogger(
    logger,
    5,  // number of allowed messages
    1, TimeUnit.HOUR  // 1 more message every hour
);


With this information you should be able to write the same code as I did. Be sure to write some unit tests for the throttling algorithm, to demonstrate that it works indeed like you want it to work.

If you don't need this additional complexity, you should at least move the errorOccurred = assignment into the body of the if statement.