Skip to content
This repository has been archived by the owner on Jun 29, 2024. It is now read-only.

Commit

Permalink
Add chunk_size config and defaults.
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmollenhour committed Apr 17, 2012
1 parent aa0726a commit 145ec45
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/code/community/Hackathon/Logger/Model/Graylog2.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function __construct($filename)
$helper = Mage::helper('hackathon_logger'); /* @var $helper Hackathon_Logger_Helper_Data */
$this->options['hostname'] = $helper->getLoggerConfig('graylog2/hostname');
$this->options['port'] = $helper->getLoggerConfig('graylog2/port');
$this->options['chunk_size'] = $helper->getLoggerConfig('graylog2/chunk_size');
$this->options['filename'] = $filename;
}

Expand Down Expand Up @@ -64,7 +65,7 @@ public function shutdown()
// Finally, send the Event, but re-throw any exceptions at the
// proper level of abstraction.
try {
$graylog2 = new GELFMessagePublisher($this->options['hostname'], $this->options['port']);
$graylog2 = new GELFMessagePublisher($this->options['hostname'], $this->options['port'], $this->options['chunk_size']);

$msg = new GELFMessage();
//$msg->setShortMessage('something is broken.');
Expand Down
11 changes: 10 additions & 1 deletion app/code/community/Hackathon/Logger/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,13 @@
</hackathon_logger>
</blocks>
</global>
</config>
<default>
<logger>
<graylog2>
<hostname>localhost</hostname>
<port>12201</port>
<chunk_size>1420</chunk_size>
</graylog2>
</logger>
</default>
</config>
13 changes: 11 additions & 2 deletions app/code/community/Hackathon/Logger/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,23 @@
<port translate="label">
<label>Port</label>
<frontend_type>text</frontend_type>
<sort_order>10</sort_order>
<sort_order>20</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</port>
<chunk_size translate="label">
<label>Chunk Size</label>
<frontend_type>text</frontend_type>
<sort_order>30</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment>This should be 1420 for WAN, 8154 for LAN.</comment>
</chunk_size>
</fields>
</graylog2>
</groups>
</logger>
</sections>
</config>
</config>

0 comments on commit 145ec45

Please sign in to comment.