spring-batch icon indicating copy to clipboard operation
spring-batch copied to clipboard

Use separate parameters for short_context length and exit_message length

Open spring-projects-issues opened this issue 12 years ago • 1 comments
trafficstars

Sebastien Lorber opened BATCH-1978 and commented

Hello,

In my usecase we have Java stacktraces as Exit Message. These stacktraces are currently truncated because of the default 2500 limit. This is a problem because the important part to the stack (caused by) is at the end and, oftenly, it's truncated.

In org.springframework.batch.core.repository.support.JobRepositoryFactoryBean#setMaxVarCharLength It would be nice to have the possibility to specify a distinct value for short_context and exit_message. Because it is not a problem if short_context is truncated for me, but it is for exit_message.

As I'm going to increase that limit, I also need to update the MySQL schema for short_context, to avoir problems with the varchar(2500): ALTER TABLE BATCH_JOB_EXECUTION MODIFY EXIT_MESSAGE TEXT; ALTER TABLE BATCH_STEP_EXECUTION MODIFY EXIT_MESSAGE TEXT; ALTER TABLE BATCH_STEP_EXECUTION_CONTEXT MODIFY SHORT_CONTEXT TEXT; ALTER TABLE BATCH_JOB_EXECUTION_CONTEXT MODIFY SHORT_CONTEXT TEXT;

By the way, it would be nice to be able to deactivate the truncation, in case the engine can truncate the exit_message itself. In MySQL, the TEXT type will handle the truncation, so I can safely put MAX_INT as a limit in setMaxVarCharLength


Affects: 2.1.9

spring-projects-issues avatar Mar 05 '13 03:03 spring-projects-issues

Mahmoud Ben Hassine commented

Hi,

I do confirm, the maxVarCharLength is used for both exitMessageLength and shortContextLength. When increased to a high value to support long stack traces, we would allocate more space than needed for the shortContext, which is obviously wasteful. So the suggested improvement makes sense to me. Thank you for this suggestion!

You are welcome to open a PR on github and we will consider merging it in a future version.

Kr, Mahmoud

spring-projects-issues avatar Nov 09 '18 23:11 spring-projects-issues