log

Overview

This object contains various methods used to log information about a running scraping session to log files, the workbench "Log" tab, and the web interface.

addAutoProgressBar

void log.addAutoProgressBar ( String name, String ... values ) (enterprise edition only)
void log.addAutoProgressBar ( String name, String[][] values ) (enterprise edition only)
void log.addAutoProgressBar ( String name, Collection<String> values ) (enterprise edition only)
void log.addAutoProgressBar ( String name, String[][] values, int keyIndex ) (enterprise edition only)
void log.addAutoProgressBar ( String name, DataSet values, String key ) (enterprise edition only)

Description

Creates an automatic progress bar and adds it to the progress bars. These progress bars match their progress to a value from a session variable and a list of values. When web messages are output with the webDebug, webInfo, webWarn, or webError methods, a progress bar will be drawn to give a visual representation of the current progress of the scrape.

Note that when using auto progress bars, it is advised to not use any manually monitored ones, as it can cause conflicts. Anytime an auto progress bar has no session variable set for its monitored key, it deletes itself and all children progress bars (including manual ones). As long as you keep that in mind, it should be safe to use both types together.

Parameters

  • name The name of the progress bar, which should match the session variable where the value for updating this bar will be stored
  • values The values this progress bar can have, in the order they will be queried. For example, if the session variable can be "1" or "2", the values should also be "1" and "2"
  • keyIndex (optional) The index in each inner array of the value that will be set in the session variable. This is only applicable when a 2D array is given. When a 2D array is given but no index is given, 0 is used.
  • key (optional) The key in the DataRecords that will be used for the session variable matching name. Used only with the DataSet method option

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.31a Available in enterprise edition.
5.5.43a Moved from session to log class.

Examples

Create an auto progress bar to track the search

 // Searching over each letter of the alphabet
 String[] letters = new String[26];
 for(char c = 'a'; c <= 'z'; c++)
   letters[ c - 'a' ] = "" + c;

 // Using this approach is more convenient when values will get changed in various scripts
 log.addAutoProgressBar("SEARCH_LETTER", letters);

 for(int i = 0; i < letters.length; i++)
 {
   session.setVariable("SEARCH_LETTER", letters[ i ]);
   session.scrapeFile("Search");
   log.logMonitoredValues("Completed Letter");
 }

addMonitoredPostfix

void log.addMonitoredPostfix ( String postfix ) (enterprise edition only)

Description

Watches for all session variables whose keys end with the postfix specified, and will output their values when monitored variables are logged.

Parameters

  • postfix The postfix to monitor

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.42a Moved from session to log class.

Examples

Watch all variables ending with _PARAM and log their values

 log.addMonitoredPostfix("_PARAM");

 // Log the current value of all session variables whose name end with _PARAM
 log.logMonitoredValues();

addMonitoredPrefix

void log.addMonitoredPrefix ( String prefix ) (enterprise edition only)

Description

Watches for all session variables whose keys begin with the prefix specified, and will output their values when monitored variables are logged.

Parameters

  • prefix The prefix to monitor

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.42a Moved from session to log class.

Examples

Watch all variables starting with SEARCH_ and log their values

 log.addMonitoredPrefix("SEARCH_");

 // Log the current value of all session variables whose name starts with SEARCH_
 log.logMonitoredValues();

addMonitoredValue

Object log.addMonitoredValue ( String name, Object value ) (enterprise edition only)

Description

Adds a specific name and value to be logged with the web messages methods or logMonitoredValues method

Parameters

  • name The name for the value being monitored
  • value The value to associate with the given name

Return Value

The previous value associated with the name, or null if there wasn't one

Change Log

Version Description
5.5.29a Available in all editions.
5.5.42a Moved from session to log class.

Examples

Add and log a value

 // Setting a value this way will persist it across scripts.
 // That way a future script could log the set, and any other values set.
 log.addMonitoredValue("The dataSet", dataSet);

 // Each time this method is called, it will log the above dataSet
 log.logMonitoredValues();

addMonitoredVariable

void log.addMonitoredVariable ( String key ) (enterprise edition only)

Description

Watches the value of a session variable, and will output it each time monitored variables are output

Parameters

  • key The key in the session corresponding to a value

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.42a Moved from session to log class.

Examples

Watch a variable and log its value

 log.addMonitoredVariable("NAME");

 // Log the current value of NAME, as well as any other currently monitored values
 log.logMonitoredVariables();

addProgressBar

ProgressBar log.addProgressBar ( String title ) (enterprise edition only)
ProgressBar log.addProgressBar ( String title, String total ) (enterprise edition only)
ProgressBar log.addProgressBar ( String title, double total ) (enterprise edition only)
ProgressBar log.addProgressBarIfNotStopped ( String title ) (enterprise edition only)
ProgressBar log.addProgressBarIfNotStopped ( String title, String total ) (enterprise edition only)
ProgressBar log.addProgressBarIfNotStopped ( String title, double total ) (enterprise edition only)

Description

Adds a new progress bar. If no progress bar exists, this will be set as the root, otherwise it will be the child of the lowest progress bar. When web messages are output with the webDebug, webInfo, webWarn, or webError methods, a progress bar will be drawn to give a visual representation of the current progress of the scrape. The addProgressBarIfNotStopped versions remove the progress bar if the scrape has not been stopped, which is useful for determining when a scrape was stopped.

Parameters

  • title The title for the new progress bar
  • total (optional) The total for the new progress bar. This should be the total number of things this is tracking the progress of. For example, if used when iterating over each letter of the alphabet for a search, the total would be 26 (one for each letter).

Return Value

This method returns a reference to the new progress bar, which can be used to update the current progress

Change Log

Version Description
5.5.29a Available in all editions.
5.5.31a Available in enterprise edition.
5.5.43a Moved from session to log class.

Examples

Track the progress of a search over the alphabet

 import com.screenscraper.util.ProgressBar;

 ProgressBar bar = log.addProgressBar("Letter", 26);
 for(char c = 'a'; c <= 'z'; c++)
 {
   session.setVariable("SEARCH_LETTER", c);
   session.scrapeFile("Search");
   bar.add(1);
   
   // For Professional and Enterprise Editions
   log.webInfo("Completed Search on: " + c);
   
   // For Basic Edition ** Note that this method is available in Professional and Enterprise editions also
   log.logMonitoredValues();
 }

 // Now that we have completed the search, remove the progress bar
 log.removeProgressBar(bar);

appendStatusMessage

boolean log.appendStatusMessage ( String message ) (enterprise edition only)

Description

Appends a status message to be displayed in the web interface.

Parameters

  • message The message to be appended.

Return Values

None

Change Log

Version Description
5.5.32a Available in Enterprise edition.
5.5.43a Moved from session to log class.

Examples

Append a status message

if( scrapeableFile.getExtractorPatternTimedOut() )
{
        log.appendStatusMessage( "Extractor pattern timed out." );
}

cacheFile

File log.cacheFile ( String outputFilenameAndPath, File fileToCache ) (professional and enterprise editions only)

Description

Adds a file to the cache. This can be used to add anything to the cache, from a text file to an image that was downloaded, or any other file that would be useful.

Parameters

  • outputFilenameAndPath The name of the file in the cache, including any directory it should be placed in
  • fileToCache The file that should be cached. This cannot be a directory

Return Value

A File that represents the cached file.

Change Log

Version Description
5.5.29a Available in professional and enterprise editions.
5.5.43a Moved from session to log class.

Examples

Cache a file

 // Set the path in the first parameter so it will show up in a subdirectory in the final output
 log.cacheFile("images/products/" + dataRecord.get("PRODUCT_NAME") + ".jpg", new File("output/downloadedImage.jpg"));

cacheScrapeableFile

File log.cacheScrapeableFile ( ScrapeableFile scrapeableFile ) (professional and enterprise editions only)

Description

Caches the HTML and headers of the scrapeable file. This will include both the request and response headers.

Parameters

  • scrapeableFile The scrapeable file to cache.

Return Value

A File that represents the cached file.

Change Log

Version Description
5.5.29a Available in professional and enterprise editions.
5.5.43a Moved from session to log class.

Examples

Cache the current file

 // Note that this will cause a duplicate file, as with caching enabled this will happen automatically.
 // It may be useful in some cases if file manipulation is going to be performed on the returned File
 log.cacheScrapeableFile(scrapeableFile);

cacheText

File log.cacheText ( String name, String content, String encoding ) (professional and enterprise editions only)
File log.cacheText ( String name, String content ) (professional and enterprise editions only)

Description

Adds text to the cache. This will create a new text file in the cache and store the given content in it.

Parameters

  • name The name of the file in the cache, including any directory it should be placed in
  • content The content to place in the cache
  • encoding The encoding to use for the text, or null to use the default encoding for the session

Return Value

A File that represents the cached file.

Change Log

Version Description
5.5.29a Available in professional and enterprise editions.
5.5.43a Moved from session to log class.

Examples

Cache the extracted section for a DataRecord

 log.cacheText("Datarecord.html", dataRecord.get("DATARECORD"), "UTF-8");

debug

void log.debug ( Object message )

Description

Write message to the log.

Parameters

  • message Message to be written to the log after being converted to a String using String.valueOf( message ).

Return Values

Returns void.

Change Log

Version Description
5.5 Now accepts any Object as a message
4.5 Available for all editions.

When the workbench is running, this will be found under the log tab for the scraping
session. When screen-scraper is running in server mode, the message will get sent to the corresponding .log file found in screen-scraper's log folder. When screen-scraper is invoked from the command
line, the message will get sent to standard out.

Examples

Write to Log

 // Sends the message to the log.
 log.debug( "Inserting extracted data into the database." );

See Also

  • info() [log] - Sends a message to the log as an informative message
  • warn() [log] - Sends a message to the log as an warning message
  • error() [log] - Sends a message to the log as a error message
  • logDebug() [session] - Write message to the log as a debug message
  • log() [log] - Write message to the log
  • log() [session] - Write message to the log

enableCaching

void log.enableCaching ( String description, boolean saveLogs, boolean zipCachedFiles ) (professional and enterprise editions only)

Description

Enables caching for this scrape. When caching is enabled, each time a scrapeable file is downloaded it will be saved to the file system. Once the session is completed the cache will be either zipped or the directory renamed, depending on the conditions that were specified when the cache was enabled. Optionally this will save the log files to the cached location, and will save everything from the error.log file that was added while the cache was enabled.

Parameters

  • description A description to use in the cached file name
  • saveLogs True if logs should be included in the cache
  • zipCachedFiles True if the cached files should be zipped once the scrape ends.

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in professional and enterprise editions.
5.5.32a Renamed from enableCache to enableCaching
5.5.43a Moved from session to log class.

Examples

Cache the pages requested by the scrape

 // No special description is needed, but we want logs to be saved, and the output to be a zipped file
 log.enableCaching("", true, true);

endCaching

void log.endCaching ( ) (professional and enterprise editions only)

Description

Ends the caching for the scrape. This method will be called once all the scripts and files are run/scraped. It can be called in a script to end the caching early (thereby only caching a portion of the scrape). This only deals with saving downloaded content to the file system, not with reading it back in during a scrape.

Parameters

This method takes no parameters

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in professional and enterprise editions.
5.5.32a Renamed from endCache to endCaching.
5.5.43a Moved from session to log class.

Examples

Cache the pages requested by the scrape

 // End the cache manually before the scrape ends
 log.endCaching();

error

void log.error ( Object message )

Description

Write message to the log.

Parameters

  • message Message to be written to the log after being converted to a String using String.valueOf( message ).

Return Values

Returns void.

Change Log

Version Description
5.5 Now accepts any Object as a message
4.5 Available for all editions.

When the workbench is running, this will be found under the log tab for the scraping
session. When screen-scraper is running in server mode, the message will get sent to the corresponding .log file found in screen-scraper's log folder. When screen-scraper is invoked from the command
line, the message will get sent to standard out.

Examples

Write to Log

 // Sends the message to the log.
 log.error( "Inserting extracted data into the database." );

See Also

  • info() [log] - Sends a message to the log as an informative message
  • debug() [log] - Sends a message to the log as a debugging message
  • warn() [log] - Sends a message to the log as an warning message
  • logError() [session] - Sends a message to the log as an error message
  • log() [log] - Write message to the log
  • log() [session] - Sends a message to the log

getCachingEnabled

boolean log.getCachingEnabled ( ) (professional and enterprise editions only)

Description

Returns whether or not the cache is enabled for the scrape. When enabled, it simply means that each ScrapeableFile will save the content it downloads from the server to the file system so it can be viewed later, generally for debugging purposes.

Parameters

This method takes no parameters

Return Value

Returns true if caching is currently enabled for this session

Change Log

Version Description
5.5.29a Available in all editions.
5.5.32a Available enterprise and professional editions (Returns false in basic edition, but doesn't throw an Exception).
Renamed from getCacheEnabled to getCachingEnabled.
5.5.43a Moved from session to log class.

Examples

Log the cache state

 if(log.getCachingEnabled())
 {
   session.log("Currently caching the session.");
 }

getProgressBar

ProgressBar log.getProgressBar ( int index ) (enterprise edition only)
ProgressBar log.getProgressBar ( String title ) (enterprise edition only)

Description

Returns the progress bar specified. If the index if given, returns the progress bar at that index (0 is the root, 1 is the first child, etc...). If the title is given, returns the most recently added progress bar with the given title

Parameters

  • index (optional) The desired ProgressBar's index
  • title (optional) The title to search for

Return Value

The ProgressBar indicated, or null if none was found matching the required criteria

Change Log

Version Description
5.5.29a Available in all editions.
5.5.31a Available in enterprise edition.
5.5.43a Moved from session to log class.

Examples

Track the progress of a search over the alphabet

 import com.screenscraper.util.ProgressBar;

 ProgressBar bar = log.addProgressBar("Letter", 26);
 for(char c = 'a'; c <= 'z'; c++)
 {
   session.setVariable("SEARCH_LETTER", c);
   session.scrapeFile("Search");
   bar.add(1);

   // For Professional and Enterprise Editions
   log.webInfo("Completed Search on: " + c);

   // For Basic Edition ** Note that this method is available in Professional and Enterprise editions also
   log.logMonitoredValues();
 }

 // Now that we have completed the search, remove the progress bar
 log.removeProgressBar(bar);

 // Increment the value of the Category progress bar (created in a separate script).
 // It is generally recommended to save a reference as a session variable rather than using this method
 log.getProgressBar("Category").add(1);

info

void log.info ( Object message )

Description

Write message to the log.

Parameters

  • message Message to be written to the log after being converted to a String using String.valueOf( message ).

Return Values

Returns void.

Change Log

Version Description
5.5 Now accepts any Object as a message
4.5 Available for all editions.

When the workbench is running, this will be found under the log tab for the scraping
session. When screen-scraper is running in server mode, the message will get sent to the corresponding .log file found in screen-scraper's log folder. When screen-scraper is invoked from the command
line, the message will get sent to standard out.

Examples

Write to Log

 // Sends the message to the log.
 log.info( "Inserting extracted data into the database." );

See Also

  • debug() [log] - Sends a message to the log as a debugging message
  • warn() [log] - Sends a message to the log as an warning message
  • error() [log] - Sends a message to the log as a error message
  • logInfo() [session] - Sends a message to the log as an info message
  • log() [log] - Write message to the log
  • log() [session] - Write message to the log

log

void log.log ( Object message )

Description

Write message to the log.

Parameters

  • message Message to be written to the log after being converted to a String using String.valueOf( message ).

Return Values

Returns void.

Change Log

Version Description
5.5 Now accepts any Object as a message
4.5 Available for all editions.

When the workbench is running, this will be found under the log tab for the scraping
session. When screen-scraper is running in server mode, the message will get sent to the corresponding .log file found in screen-scraper's log folder. When screen-scraper is invoked from the command
line, the message will get sent to standard out.

Examples

Write to Log

 // Sends the message to the log.
 log.log( "Inserting extracted data into the database." );

See Also

  • debug() [log] - Sends a message to the log as a debugging message
  • info() [log] - Sends a message to the log as an informative message
  • warn() [log] - Sends a message to the log as an warning message
  • error() [log] - Sends a message to the log as a error message
  • log() [session] - Write message to the log

logDataRecord

void log.logDataRecord ( DataRecord record )
void log.logDataRecord ( DataRecord record, int logLevel )
void log.logDataRecordDebug ( DataRecord record ) (professional and enterprise editions only)
void log.logDataRecordInfo ( DataRecord record ) (professional and enterprise editions only)
void log.logDataRecordWarn ( DataRecord record ) (professional and enterprise editions only)
void log.logDataRecordError ( DataRecord record ) (professional and enterprise editions only)

Description

Logs all the values in a Data Record to the log, with one line per value. If a value in the record is a List, Set, Map, Data Set, Scrapeable File, or Exception, it will have detailed output as well.

Parameters

  • record The Data Record to output to the log
  • logLevel (optional) The level to log the data record at, as an int
    Values are 1-Debug, 2-Info, 3-Warn, 4-Error, or can be obtained from com.screenscraper.common.Notifiable.LEVEL_(DEBUG/INFO/WARN/ERROR)
    When omitted, the log level used is the session logging level.

Return Values

This method returns nothing

Change Log

Version Description
5.5.26a Available in all editions.
5.5.43a Moved from session to log class.

Examples

Log a Data Record

 // Log a scraped data record before saving it to a database
 log.logDataRecord(dataRecord);

The output from the above call might look something like this:

DataRecord
--- A_FLOAT : 3.14159
--- A_LIST : List
------ Element 0 : Value 1
------ Element 1 : Value 2
------ Element 2 : Value 3
------ Element 3 : Set
--------- Element : A value
--------- Element : More value
--------- Element : Other stuff
--- A_MAP : Map
------ KEY_1 : 1
------ KEY_2 : 2
------ KEY_3 : 3
--- A_SET : Set Logged above as "------ Element 3 : "
--- A_STRING : Screen-Scraper
--- AN_INT : 5

logException

void log.logException ( Exception exception )

Description

Logs an Exception, with a full stack trace, at the Error level

Parameters

  • exception The Exception to log

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.43a Moved from session to log class.

Examples

Log an exception

 try
 {
   int result = Integer.parseInt(dataRecord.get("SCRAPED_VALUE"));
 }
 catch(Exception e)
 {
   log.logException(e);
 }

logMonitoredValues

void log.logMonitoredValues ( Object message )
void log.logMonitoredValues ( Object message, int logLevel )
void log.logMonitoredValuesDebug ( Object message ) (professional and enterprise editions only)
void log.logMonitoredValuesInfo ( Object message ) (professional and enterprise editions only)
void log.logMonitoredValuesWarn ( Object message ) (professional and enterprise editions only)
void log.logMonitoredValuesError ( Object message ) (professional and enterprise editions only)

Description

Logs the values of all the currently monitored variables, the progress of the scrape, if known, and puts the message at the top. Also logs any additional values being watched. Logs values at the specified level.

Parameters

  • message A message to output as a header for this log entry
  • logLevel (optional) The level to log at

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.43a Moved from session to log class.

Examples

Log the currently monitored values and progress bars

 log.logMonitoredValues("Record Saved");

logMonitoredValuesClose

void log.logMonitoredValuesClose ( Object message ) (professional and enterprise editions only)

Description

Logs closing values to indicate the scrape is complete and what values were when everything finished. It will log at whatever the highest level logged to was. For instance, if a webWarn had been logged during the scrape, this will log at the warning level.

Parameters

  • message A message to output as a header for this log entry

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.43a Moved from session to log class.

Examples

Log the currently monitored values at the end of the scrape

 log.logMonitoredValuesClose("Scrape Completed");

logObjectByType

void log.logObjectByType ( Object object )
void log.logObjectByType ( Object object, int logLevel )
void log.logObjectByTypeDebug ( Object object ) (professional and enterprise editions only)
void log.logObjectByTypeInfo ( Object object ) (professional and enterprise editions only)
void log.logObjectByTypeWarn ( Object object ) (professional and enterprise editions only)
void log.logObjectByTypeError ( Object object ) (professional and enterprise editions only)

Description

Logs the Object in a semi intelligent way. For example, Maps are logged as key-value pairs, lists are logged with one element per line, all elements of a set are logged, etc... Some objects will just log their value using String.valueOf() if it isn't a standard type of data set/list

Parameters

  • object The Object to write to the log
  • logLevel (optional) The level to log the data record at, as an int

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.43a Moved from session to log class.

Examples

Log the dataSet

 log.logObjectByType(dataSet);

logScreenScraperInformation

void log.logScreenScraperInformation ( )

Description

Logs useful information about the current instance of Screen-Scraper, as well as the Java VM and the General Utility version being used. Information will be logged as an info message in the web interface (when running in server mode) and the log.

Parameters

This method takes no parameters

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.43a Moved from session to log class.

Examples

Log Current Info

 log.logScreenScraperInformation();

removeMonitoredPostfix

void log.removeMonitoredPostfix ( String postfix ) (enterprise edition only)

Description

Stops watching for a postfix in session variables

Parameters

  • postfix Postfix to remove from monitoring

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.43a Moved from session to log class.

Examples

Stop watching and logging the value of all session variables ending with _PARAM

 log.removeMonitoredPostfix("_PARAM");

removeMonitoredPrefix

void log.removeMonitoredPrefix ( String prefix ) (enterprise edition only)

Description

Stops watching for a prefix in session variables

Parameters

  • prefix Prefix to remove from monitoring

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.43a Moved from session to log class.

Examples

Stop watching and logging the value of all session variables starting with SEARCH_

 log.removeMonitoredPrefix("SEARCH_");

removeMonitoredValue

Object log.removeMonitoredValue ( String name ) (enterprise edition only)

Description

Removes a specific name from the manually set values to be logged. Doesn't affect the value of session variables

Parameters

  • name The name for the value being monitored

Return Value

The previous value associated with the name, or null if there wasn't one

Change Log

Version Description
5.5.29a Available in all editions.
5.5.43a Moved from session to log class.

Examples

Remove a value so it won't be logged by logMonitoredValues

 log.removeMonitoredValue("The dataSet");

removeMonitoredVariable

void log.removeMonitoredVariable ( String key ) (enterprise edition only)

Description

Stops watching the specified variable

Parameters

  • key Key for the variable to stop watching

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.43a Moved from session to log class.

Examples

Stop watching and logging the value of the session varaible NAME

 log.removeMonitoredVariable("NAME");

removeProgressBar

void log.removeProgressBar ( ProgressBar progressBar ) (enterprise edition only)
void log.removeProgressBarIfNotStopped ( ProgressBar progressBar ) (enterprise edition only)

Description

Removes the specified progress bar. The removeProgressBarIfNotStopped version removes the progress bar if the scrape has not been stopped, which is useful for determining when a scrape was stopped.

Parameters

  • progressBar The ProgressBar to remove

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in all editions.
5.5.31a Available in enterprise edition.
5.5.43a Moved from session to log class.

Examples

Track the progress of a search over the alphabet

 import com.screenscraper.util.ProgressBar;

 ProgressBar bar = log.addProgressBar("Letter", 26);
 for(char c = 'a'; c <= 'z'; c++)
 {
   log.setVariable("SEARCH_LETTER", c);
   session.scrapeFile("Search");
   bar.add(1);

   // For Professional and Enterprise Editions
   log.webInfo("Completed Search on: " + c);

   // For Basic Edition ** Note that this method is available in Professional and Enterprise editions also
   log.logMonitoredValues();
 }

 // Now that we have completed the search, remove the progress bar
 log.removeProgressBar(bar);

warn

void log.warn ( Object message )

Description

Write message to the log.

Parameters

  • message Message to be written to the log after being converted to a String using String.valueOf( message ).

Return Values

Returns void.

Change Log

Version Description
5.5 Now accepts any Object as a message
4.5 Available for all editions.

When the workbench is running, this will be found under the log tab for the scraping
session. When screen-scraper is running in server mode, the message will get sent to the corresponding .log file found in screen-scraper's log folder. When screen-scraper is invoked from the command
line, the message will get sent to standard out.

Examples

Write to Log

 // Sends the message to the log.
 log.warn( "Inserting extracted data into the database." );

See Also

  • info() [log] - Sends a message to the log as an informative message
  • debug() [log] - Sends a message to the log as a debugging message
  • error() [log] - Sends a message to the log as a error message
  • logWarn() [session] - Write message to the log as a warning message
  • log() [log] - Write message to the log
  • log() [session] - Write message to the log

webClose

void log.webClose ( Object object ) (professional and enterprise editions only)

Description

Logs closing values to indicate the scrape is complete and what values were when everything finished. It will log at whatever the highest level logged to was. For instance, if a webWarn had been logged during the scrape, this will log at the warning level. When running in Professional edition, this simply outputs to the log.

Using this method is preferred over logMonitoredValuesClose (which only logs to the log), because if at a later point the scrape is run in server mode for enterprise edition, a useful message is output in the web interface without needing to modify the scrape.

Parameters

  • object The message to display as a header

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in professional and enterprise editions.
5.5.43a Moved from session to log class.

Examples

Log monitored variables at the end of the scrape

 log.webClose("Scrape Completed");

webDebug

void log.webDebug ( Object object ) (professional and enterprise editions only)
void log.webDebug ( Object object, boolean saveMessage ) (professional and enterprise editions only)
void log.webDebug ( Object object, Object loggable ) (professional and enterprise editions only)
void log.webDebug ( Object object, boolean saveMessage, Object loggable ) (professional and enterprise editions only)

Description

Logs a debug message to the web interface status message area. Uses the message header as the top of the message, and then logs all currently monitored session variables underneath as well as the current progress (if known) of the scrape. Also outputs the message to the log. When running in Professional edition, this simply outputs to the log.

Using this method is preferred over logMonitoredValues (which only logs to the log), because if at a later point the scrape is run in server mode for enterprise edition, a useful message is output in the web interface without needing to modify the scrape.

Parameters

  • object The message to display as a header
  • saveMessage (optional) Whether or not to save this message and continue to display it below future web messages. By default debug messages are not saved.
  • loggable (optional) An additional object to log, most likely a DataRecord. This will only be logged with this message, and not 'monitored' like other values

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in professional and enterprise editions.
5.5.43a Moved from session to log class.

Examples

Log monitored variables and progress

 log.webDebug("Record Saved");

webError

void log.webError ( Object object ) (professional and enterprise editions only)
void log.webError ( Object object, boolean saveMessage ) (professional and enterprise editions only)
void log.webError ( Object object, Object loggable ) (professional and enterprise editions only)
void log.webError ( Object object, boolean saveMessage, Object loggable ) (professional and enterprise editions only)

Description

Logs an error message to the web interface status message area. Uses the message header as the top of the message, and then logs all currently monitored session variables underneath as well as the current progress (if known) of the scrape. Also outputs the message to the log. When running in Professional edition, this simply outputs to the log.

Using this method is preferred over logMonitoredValues (which only logs to the log), because if at a later point the scrape is run in server mode for enterprise edition, a useful message is output in the web interface without needing to modify the scrape.

Parameters

  • object The message to display as a header
  • saveMessage (optional) Whether or not to save this message and continue to display it below future web messages. By default error messages are saved.
  • loggable (optional) An additional object to log, most likely a DataRecord. This will only be logged with this message, and not 'monitored' like other values

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in professional and enterprise editions.
5.5.43a Moved from session to log class.

Examples

Log monitored variables and progress

 log.webError("Record Saved");

webInfo

void log.webInfo ( Object object ) (professional and enterprise editions only)
void log.webInfo ( Object object, boolean saveMessage ) (professional and enterprise editions only)
void log.webInfo ( Object object, Object loggable ) (professional and enterprise editions only)
void log.webInfo ( Object object, boolean saveMessage, Object loggable ) (professional and enterprise editions only)

Description

Logs an info message to the web interface status message area. Uses the message header as the top of the message, and then logs all currently monitored session variables underneath as well as the current progress (if known) of the scrape. Also outputs the message to the log. When running in Professional edition, this simply outputs to the log.

Using this method is preferred over logMonitoredValues (which only logs to the log), because if at a later point the scrape is run in server mode for enterprise edition, a useful message is output in the web interface without needing to modify the scrape.

Parameters

  • object The message to display as a header
  • saveMessage (optional) Whether or not to save this message and continue to display it below future web messages. By default info messages are not saved.
  • loggable (optional) An additional object to log, most likely a DataRecord. This will only be logged with this message, and not 'monitored' like other values

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in professional and enterprise editions.
5.5.43a Moved from session to log class.

Examples

Log monitored variables and progress

 log.webInfo("Record Saved");

webWarn

void log.webWarn ( Object object ) (professional and enterprise editions only)
void log.webWarn ( Object object, boolean saveMessage ) (professional and enterprise editions only)
void log.webWarn ( Object object, Object loggable ) (professional and enterprise editions only)
void log.webWarn ( Object object, boolean saveMessageloggable> ) (professional and enterprise editions only)

Description

Logs a warning message to the web interface status message area. Uses the message header as the top of the message, and then logs all currently monitored session variables underneath as well as the current progress (if known) of the scrape. Also outputs the message to the log. When running in Professional edition, this simply outputs to the log.

Using this method is preferred over logMonitoredValues (which only logs to the log), because if at a later point the scrape is run in server mode for enterprise edition, a useful message is output in the web interface without needing to modify the scrape.

Parameters

  • object The message to display as a header
  • saveMessage (optional) Whether or not to save this message and continue to display it below future web messages. By default warn messages are saved.
  • loggable (optional) An additional object to log, most likely a DataRecord. This will only be logged with this message, and not 'monitored' like other values

Return Value

This method returns void.

Change Log

Version Description
5.5.29a Available in professional and enterprise editions.
5.5.43a Moved from session to log class.

Examples

Log monitored variables and progress

 log.webWarn("Record Saved");