/** * Create a socket connection using defined parameters */ function activateOptions() { LoggerLog::debug("LoggerAppenderSocket::activateOptions() creating a socket..."); $errno = 0; $errstr = ''; $this->sp = @fsockopen($this->getRemoteHost(), $this->getPort(), $errno, $errstr, $this->getTimeout()); if ($errno) { LoggerLog::debug("LoggerAppenderSocket::activateOptions() socket error [{$errno}] {$errstr}"); $this->closed = true; } else { LoggerLog::debug("LoggerAppenderSocket::activateOptions() socket created [" . $this->sp . "]"); if ($this->getUseXml()) { $this->xmlLayout = LoggerLayout::factory('LoggerXmlLayout'); if ($this->xmlLayout === null) { LoggerLog::debug("LoggerAppenderSocket::activateOptions() useXml is true but layout is null"); $this->setUseXml(false); } else { $this->xmlLayout->setLocationInfo($this->getLocationInfo()); $this->xmlLayout->setLog4jNamespace($this->getLog4jNamespace()); $this->xmlLayout->activateOptions(); } } $this->closed = false; } }
/** * Create a socket connection using defined parameters */ public function activateOptions() { if (!$this->dry) { $this->sp = @fsockopen($this->getRemoteHost(), $this->getPort(), $errno, $errstr, $this->getTimeout()); if ($this->sp === false) { throw new LoggerException("Could not open socket to " . $this->getRemoteHost() . ":" . $this->getPort() . ": {$errstr} ({$errno})"); } } if ($this->getUseXml()) { $this->xmlLayout = LoggerReflectionUtils::createObject('LoggerLayoutXml'); if ($this->xmlLayout === null) { $this->setUseXml(false); } else { $this->xmlLayout->setLocationInfo($this->getLocationInfo()); $this->xmlLayout->setLog4jNamespace($this->getLog4jNamespace()); $this->xmlLayout->activateOptions(); } } $this->closed = false; }