0

Contents of log file are

Caused by: com.ofss.fc.framework.exception.BusinessException: The memo start date cannot be earlier than the process date.
at com.ofss.fc.domain.party.service.core.CommentService.validateMemos(CommentService.java:474)
at com.ofss.fc.lz.us.appx.party.service.core.ext.RegionalPartyAddressApplicationServiceSpiExt.preUpdatePartyAddress(RegionalPartyAddressApplicationServiceSpiExt.java:43)
at com.ofss.fc.appx.party.service.core.ext.PartyAddressApplicationServiceSpiExtExecutor.preUpdatePartyAddress(PartyAddressApplicationServiceSpiExtExecutor.java:82)
at com.ofss.fc.appx.party.service.core.PartyAddressApplicationServiceSpi.updatePartyAddress(PartyAddressApplicationServiceSpi.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Caused by: com.ofss.fc.framework.exception.BusinessException: The memo start date cannot be earlier than the process date.
at com.ofss.fc.domain.party.service.core.CommentService.validateMemos(TestService.java:474)
at com.ofss.fc.lz.us.appx.party.service.core.ext.RegionalPartyAddressApplicationServiceSpiExt.preUpdatePartyAddress(RegionalPartyAddressApplicationServiceSpiExt.java:43)
at com.ofss.fc.appx.party.service.core.ext.PartyAddressApplicationServiceSpiExtExecutor.preUpdatePartyAddress(PartyAddressApplicationServiceSpiExtExecutor.java:82)
at com.ofss.fc.appx.party.service.core.PartyAddressApplicationServiceSpi.updatePartyAddress(PartyAddressApplicationServiceSpi.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Grepping Caused to get the next line

bash-4.1$ a=$(awk '/Caused/{getline; print}' testError.log )
bash-4.1$ echo $a

Output:

com.ofss.fc.domain.party.service.core.CommentService.validateMemos(CommentService.java:474) at com.ofss.fc.domain.party.service.core.CommentService.validateMemos(TestService.java:474)

Required a list of all the name of the files inside the ()

Output of list should be:

CommentService.java
TestService.java
3

With sed:

$ sed -n '/Caused/{
  N
  s/.*\n[^(]*(//
  s/:[^:]*$//
  p
}' <file
3

Using grep, assumes java file name consisting of only alphabets, numbers and _

awk '/Caused/{getline; print}' testError.log | grep -oE '\w+\.java'

Using sed for general file name

awk '/Caused/{getline; print}' testError.log | sed -r 's/.*\((.*):.*/\1/'
2

Staying with awk

awk '/Caused/{getline; match($0, /[^(]*\.java/); 
     if (RSTART)print(substr($0, RSTART, RLENGTH))}' file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.