Merge pull request #167 from Kingsrook/feature/loggly-updates-220250325

turned down some loggly messages, added utility method to value utils
This commit is contained in:
Tim Chamberlain
2025-03-25 13:04:32 -05:00
committed by GitHub
7 changed files with 59 additions and 18 deletions

View File

@ -83,7 +83,7 @@ public class RunRecordScriptAutomationHandler extends RecordAutomationHandler
}
QRecord scriptRevision = queryOutput.getRecords().get(0);
LOG.info("Running script against records", logPair("scriptRevisionId", scriptRevision.getValue("id")), logPair("scriptId", scriptRevision.getValue("scriptIdd")));
LOG.debug("Running script against records", logPair("scriptRevisionId", scriptRevision.getValue("id")), logPair("scriptId", scriptRevision.getValue("scriptIdd")));
RunAdHocRecordScriptInput input = new RunAdHocRecordScriptInput();
input.setCodeReference(new AdHocScriptCodeReference().withScriptRevisionRecord(scriptRevision));

View File

@ -356,12 +356,12 @@ public abstract class AbstractTableSyncTransformStep extends AbstractTransformSt
{
if(existingRecord != null)
{
LOG.info("Skipping storing existing record because this sync process is set to not perform updates");
LOG.debug("Skipping storing existing record because this sync process is set to not perform updates");
willNotInsert.incrementCountAndAddPrimaryKey(sourcePrimaryKey);
}
else
{
LOG.info("Skipping storing new record because this sync process is set to not perform inserts");
LOG.debug("Skipping storing new record because this sync process is set to not perform inserts");
willNotUpdate.incrementCountAndAddPrimaryKey(sourcePrimaryKey);
}
continue;

View File

@ -475,4 +475,31 @@ public class StringUtils
return (s);
}
/***************************************************************************
**
***************************************************************************/
public static String appendIncrementingSuffix(String input)
{
////////////////////////////////
// remove any existing suffix //
////////////////////////////////
String base = input.replaceAll(" \\(\\d+\\)$", "");
if(input.matches(".* \\(\\d+\\)$"))
{
//////////////////////////
// increment if matches //
//////////////////////////
int current = Integer.parseInt(input.replaceAll(".* \\((\\d+)\\)$", "$1"));
return base + " (" + (current + 1) + ")";
}
else
{
////////////////////////////////////
// no match so put a 1 at the end //
////////////////////////////////////
return base + " (1)";
}
}
}

View File

@ -18,21 +18,13 @@
</File>
</Appenders>
<Loggers>
<Logger name="org.apache.log4j.xml" additivity="false">
</Logger>
<Logger name="org.mongodb.driver" level="WARN">
</Logger>
<Logger name="org.eclipse.jetty" level="INFO">
</Logger>
<Logger name="io.javalin" level="INFO">
</Logger>
<Logger name="org.mongodb.driver" level="WARN" />
<Logger name="org.eclipse.jetty" level="INFO" />
<Logger name="io.javalin" level="INFO" />
<!-- c3p0 -->
<Logger name="com.mchange.v2" level="INFO">
</Logger>
<Logger name="org.quartz" level="INFO">
</Logger>
<Logger name="liquibase" level="INFO">
</Logger>
<Logger name="com.mchange.v2" level="INFO" />
<Logger name="org.quartz" level="INFO" />
<Logger name="liquibase" level="INFO" />
<Root level="all">
<AppenderRef ref="SystemOutAppender"/>
<AppenderRef ref="SyslogAppender"/>

View File

@ -334,4 +334,20 @@ class StringUtilsTest extends BaseTest
assertEquals("a", StringUtils.emptyToNull("a"));
}
/*******************************************************************************
**
*******************************************************************************/
@Test
void testAppendIncrementingSuffix()
{
assertEquals("test (1)", StringUtils.appendIncrementingSuffix("test"));
assertEquals("test (2)", StringUtils.appendIncrementingSuffix("test (1)"));
assertEquals("test (a) (1)", StringUtils.appendIncrementingSuffix("test (a)"));
assertEquals("test (a32) (1)", StringUtils.appendIncrementingSuffix("test (a32)"));
assertEquals("test ((2)) (1)", StringUtils.appendIncrementingSuffix("test ((2))"));
assertEquals("test ((2)) (101)", StringUtils.appendIncrementingSuffix("test ((2)) (100)"));
}
}

View File

@ -39,6 +39,7 @@ import java.util.function.Supplier;
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
import com.kingsrook.qqq.backend.core.context.QContext;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
import com.kingsrook.qqq.backend.core.logging.QLogger;
import com.kingsrook.qqq.backend.core.model.actions.AbstractTableActionInput;
@ -208,6 +209,11 @@ public class BaseAPIActionUtil
return rs;
}
catch(QNotFoundException qnfe)
{
LOG.info("Not found", qnfe);
throw (qnfe);
}
catch(Exception e)
{
LOG.error("Error in API get", e);